c# - display the value of datagridview in the textboxes present in another form -


how can use same data grid values in 2 different forms?

i have grid view displays list of buses , starting location , destination , trip date time..

and have user home page user books seats , in user page have display contents of mentioned data grid view

i used code

    public static string setvaluefortext1 = "";     public static string setvaluefortext2 = "";     public static string setvaluefortext3 = "";     public static string setvaluefortext4 = "";     public static string setvaluefortext13 = ""; 

and

        int = gv_bus.selectedcells[0].rowindex;         setvaluefortext16 = gv_bus.rows[i].cells[2].value.tostring();         setvaluefortext1 = gv_bus.rows[i].cells[3].value.tostring();         setvaluefortext2 = gv_bus.rows[i].cells[4].value.tostring();         setvaluefortext3 = gv_bus.rows[i].cells[5].value.tostring();         setvaluefortext4 = gv_bus.rows[i].cells[6].value.tostring(); 

and in user home page have used code

        lbl_startng1.text =bus_booking.bus_page.setvaluefortext1;         lbl_destination1.text = bus_booking.bus_page.setvaluefortext2;         lbl_trip1.text = bus_booking.bus_page.setvaluefortext3;         lbl_dur1.text = bus_booking.bus_page.setvaluefortext4;         lbl_no1.text = bus_booking.bus_page.setvaluefortext13; 

but not working since user page loads when debug , displays empty labels

anyone please help. in advance

there few ways , plenty of examples on site.

example here

i go using custom events , have second form subscribe events on first form.

you expose properties on second form , update first form.

i investigate first option it's cleaner.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

c++ - End of file on pipe magic during open -