c# - bind variable to .net textbox.text property -


im trying simple variable bind control text box cant life of me working. here scenario 2 forms 1 datagrid , , other 2 textboxes. when click on datagrid pass variables textboxes in form1. have tried no results. in form1

public string mytext     {         { return tuidinput.text; }         set { tuidinput.text = value; }     }  

then form 2 when try set value 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 example here http://social.msdn.microsoft.com/forums/en-us/csharpgeneral/thread/7308639f-640b-48bf-8293-abcbfd2292d8/

however not update textbox? should doing differentely?

what im doing wrong ? how can correctly have looked @ several article on here have not been successful @ of them. great appreciated.

i'm not sure if that's case, in:
form1.mytext = userpicked.tuid
you're refering newly created form1 object, initialized 1 line above. if you'll check form1.mytext property, you'll notice has value assigned, it's not form object want refer to. if textboxes in form2, create form2 reference in form1. private form2 form2 = null;
, create property

public form2 secondform { set { this.form2 = value; } } assign , use form2.tuidinput.text in form1 normally.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -