• Web sitemizin içeriğine ve tüm hizmetlerimize erişim sağlamak için Web sitemize kayıt olmalı ya da giriş yapmalısınız. Web sitemize üye olmak tamamen ücretsizdir.
  • Sohbetokey.com ile canlı okey oynamaya ne dersin? Hem sohbet et, hem mobil okey oyna!
  • Soru mu? Sorun mu? ''Bir Sorum Var?'' sistemimiz aktiftir. Paylaşın beraber çözüm üretelim.

Textbox a Girilen Yazıyı Boşluklara Göre Parçalara Bölme

Üyelik Tarihi
7 Ocak 2015
Konular
4,091
Mesajlar
4,274
MFC Puanı
40
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;
        }
 
    }
}
 
Üst