Kod:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace C_Sharp_Form_Textbox_Text_Split
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private **** btnEkle_Click(object sender, EventArgs e)
{
string [] adSoyad = txtAdSoyad.Text.Split(' ');
string ad ="";
string soyad = "";
if (adSoyad.Length == 1)
{
ad = adSoyad[0];
}
else if (adSoyad.Length == 2)
{
ad = adSoyad[0];
soyad = adSoyad[1];
}
else if (adSoyad.Length == 3)
{
ad = adSoyad[0] + " " + adSoyad[1];
soyad = adSoyad[2];
}
lblAd.Text = ad;
lblSoyad.Text = soyad;
}
}
}