im trying to do a simple variable bind to a control text box but i cant for the life of me get this working. Here is the scenario two forms 1 with datagrid and and the other with two textboxes. When i click on the datagrid i would like to pass those variables to the textboxes in FORM1. This is what i have tried with no results. in my form1
public string myText
{
get { return tuidInput.Text; }
set { tuidInput.Text = value; }
}
then i my form two when i try to set the value i try this.
private void selectUser(object sender, DataGridViewCellEventArgs e)
{
userPicked.tuid = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["spriden_id"].Value.ToString();
userPicked.Name = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["spriden_last_name"].Value.ToString();
Form1 form1 = new Form1();
form1.myText = userPicked.tuid
}
i got that example from here http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/7308639f-640b-48bf-8293-abcbfd2292d8/
however it does not update the textbox? what should i be doing differentely?
what im i doing wrong ? how can i do this correctly i have looked at several article on here but have not been successful at any of them. any help would be great appreciated.
new Form1(), i.e. you aren't setting the value in the currentForm1which is on your screen but some new instance of it....your Form2 needs a reference to the currently open instance of Form1 - do you have an example of how you're opening the forms (e.g. the code for opening Form2 from Form1 or vice versa)