My question is this. I have two forms. Form1 and Form2. Form1 contains listbox which have items on it added via another form by binding. Now what I want is when the users clicks an item on the listbox, Form2 opens which have textboxes containing the rest of information of the item that the user clicked. For example, when the customer clicks a name on the listbox, the age, address, and phone number shows on the textboxes on Form2. By the way the data are stored on a database on which is created on Visual studio itself. I'm already able to open the Form2 when the user clicks an item but I can't get to display the rest of the data. If you guys can help that would be great.
Passing selected items in listbox to another form C#
Hello guys I'm new here.
Jaganathan BantheswaranPosted Oct 15, 2013, 3:31 AM
Pass the values needed for Form2 when you are creating the instance for Form2 as shown below,
Form2 frm = new Forms(string val1, string val2....);
In Form2 constructor,
public viod Form2(string val1, string val1...)
{
InitializeComponent();
this.val1 = val1;
......
}
Then bind the values to your Form2 controls...
Mik CruzPosted Oct 15, 2013, 2:11 AM
Dharmendra SinghPosted Oct 15, 2013, 2:03 AM