Switch to full style
Codes, tips and tricks,discussions and solutions related to C#
Post a reply

add data from form1 textbox to form2 combo box

Mon Jan 18, 2010 5:11 am

Code:
namespace Passing_Data
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Form2 frm = new Form2(textBox1.Text);
            frm.Show();

        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}
FORM 2:
namespace Passing_Data
{
    public partial class Form2 : Form
    {
        public Form2(String strTextBox)
        {
            InitializeComponent();
            label1.Text = strTextBox;
        }

        private void Form2_Load(object sender, EventArgs e)
        {

        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
    }
}

I have form one with textbox and button- I enter data in textbox and click button to take me to form 2. form two has label and combobox. data displays now in label.
I want to be able to enter data in textbox on form 1 and have it entered in combobox on page two.
I have tried combobox1.items.add(strTextBox) in form2 _load- not working
thank you



Post a reply
  Related Posts  to : add data from form1 textbox to form2 combo box
 calling method to form- displaying textbox data in messagbox     -  
 Help combo box     -  
 AutoComplete TextBox     -  
 how to show hashmap value in a textbox     -  
 Disable TextBox html by php     -  
 What is Data integration?     -  
 c++/data structure     -  
 Data set for ID3 algorithm     -  
 Delete data from database by ID in php     -  
 Is String a data type     -