I\'m doing a winform which consist a listbox (listbox10) with some items on it. When I doubleclick an item, it will show another form (Form3) which consist a textbox (textbo
The textBox1 you are accessing is not on msgForm3. to access the one on msgForm3 use (as the other answers have mentioned)
msgForm3.textBox1.Text = listBox10.SelectedItem.ToString();
but since all form controls are private by default you can either change its protection level inside Form3.Designer.cs to public (or internal ) :
public System.Windows.Forms.TextBox textBox1;
or add the text that should go in textbox1 as a parameter in Form3 constructor :
public Form3(string text)
{
InitializeComponent();
this.textBox1.Text = text;
}
and when your create an instance of Form3 use
msgForm3 = new Form3(listBox10.SelectedItem.ToString());