Hello,
Hope someone can help me with this irritating error.
I have a form(Form1) with a textbox(TxtPcnummer) on it and a button(Button). When i click the button another form(Form2) opens with a datagrid(datagridview1).When i click on a cell the content need to show in the textbox of form1.This is my code:
public partial class Form1 : Form
{
public string i_pcnum;
public string pcnum
{
get { return i_pcnum; }
set { i_pcnum = value; }
}
public void UpdateTextboxen()
{
this.TxtPcnummer.Text = pcnum;
}
private void Button_Click(object sender, EventArgs e)
{
Form2 fm2 = new Form2();
fm2.Show();
}
}
public partial class Form2 : Form
{
public void dataGridView1_CellContentClick(object sender,DataGridViewCellEventArgs e)
{
string pcnummer = Convert.ToString (dataGridView1.CurrentRow.Cells ["PCNUMMER"].Value);
Form1 fm1 = new Form1();
fm1.pcnum = pcnummer;
fm1.UpdateTextboxen();
}
when i add a watch to the textbox TxtPcnummer the text value is giving me the right value but the text value is not showing in my form.So the textbox just stay empty when running the windows application.
greetz gerry