Home Forums WinForms controls Xceed Grid for WinForms An attempt was made to select a row that does not belong to Reply To: An attempt was made to select a row that does not belong to

Xceed Support
Member
Post count: 5658

You need to get the value of your second form through the first one and not the opposite.

For example, in Form1, you have a grid with some value. With a button press, you start the Form2 in which you edit the value in a TextBox (in this example “TextBox1”). You close you Form2 by setting DialogResult to OK. After, you can get the result in “TextBox1”.

Here is the code I used for this example:

<code>
//Form1
private void button1_Click( object sender, EventArgs e )
{
Form2 form2 = new Form2();
if( form2.ShowDialog() == DialogResult.OK )
{
gridControl1.DataRows[ 0 ].Cells[ 0 ].Value = form2.Controls[“TextBox1”].Text;
}
}

//Form2
private void button1_Click( object sender, EventArgs e )
{
this.DialogResult = DialogResult.OK;
}
</code>

Imported from legacy forums. Posted by CharlesB (had 3079 views)