Gönderen Konu: C# da Formlar Arası Veri Alış Verişi  (Okunma sayısı 4206 defa)

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı Yasin_0023

  • İleti: 157
  • Puan: 148
  • Cinsiyet: Bay
    • SİYAHSERİT
C# da Formlar Arası Veri Alış Verişi
« : Ağustos 20, 2008, 21:32:42 ÖS »
Formlar arası veri alış verişi, textboxtan diğer formdaki textbox a veri gönderme

Arkadaşlar Özellikle Form kısmında Bu tip soruların Çokluğundan Kısa bir Açıklama ile Aşağıdaki kodları yazdım.
Sadece iki yol ile yaptım birisi direk erişim Diğer yol ise fonksiyon yardımıyla.

KOLAY GELSİN




Form1 de bir textbox 3 button ekleyin

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace verideneme
{
    public partial class Form1 : Form
    {
       public  Form2 frm2=null;
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (frm2 != null)
                frm2.textBox1.Text = this.textBox1.Text;
            else
                MessageBox.Show("Form Gösterme Tuşuna Basınız"); 

        }

        private void button2_Click(object sender, EventArgs e)
        {
            frm2 = new Form2();
            frm2.Show();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            if (frm2!=null)
                frm2.TextBoxDoldur(textBox1.Text);
           else
                MessageBox.Show("Form Gösterme Tuşuna Basınız");
        }

        private void Form1_Load(object sender, EventArgs e)
        {
         
        }
    }
}



FORM2  de  1 text box ekleyin ve form2.designer.cs de

private  System.Windows.Forms.TextBox textBox1;

şeklindeki kodları

        //burada ki public kısmı textbox1 e dışarıdan erişimin sağlanması için önemli
        public  System.Windows.Forms.TextBox textBox1;

Şekline değiştirin


form2 kodlarıda Aşağıda


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace verideneme
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        public void  TextBoxDoldur(string txt)
        {
            textBox1.Text = txt;   
        }


    }
}

 ;D SİYAHSERİT
Konuyu Paylaş:
  delicious  facebook  twitter  google
|www .siyahserit.tr.cx | 
|www .siyahserit.tr.gg  |  |www.uzmanweb.yetkinblog.com |  |www.uzmanweb.yetkinforum.com | |www.siyahserit.turkforumpro.com  |

Çevrimdışı ceren2284

  • İleti: 1
  • Puan: 0
-C# da Formlar Arası Veri Alış Verişi
« Yanıtla #1 : Ekim 28, 2009, 14:25:45 ÖS »
çok teşekkürler

 

Benzer Konular

  Konu / Başlatan Yanıt Son İleti
0 Yanıt
1893 Gösterim
Son İleti Mart 30, 2007, 22:08:17 ÖS
Gönderen: Y.i.Y
2 Yanıt
940 Gösterim
Son İleti Mayıs 19, 2007, 13:05:43 ÖS
Gönderen: prog_cenk
3 Yanıt
1178 Gösterim
Son İleti Mayıs 18, 2007, 15:33:52 ÖS
Gönderen: ALpeR
3 Yanıt
1021 Gösterim
Son İleti Mayıs 29, 2007, 12:47:04 ÖS
Gönderen: burajan
3 Yanıt
1641 Gösterim
Son İleti Kasım 24, 2008, 18:54:54 ÖS
Gönderen: Ozgur Hicyilmaz