Hi, i got a few records displaying in a datagrid. Then if i clicked on one of the record, it should show another form displaying all the respective data in the textbox.
How do i pass the parameters to the next form?
Printable View
Hi, i got a few records displaying in a datagrid. Then if i clicked on one of the record, it should show another form displaying all the respective data in the textbox.
How do i pass the parameters to the next form?
In the form that you want to show - add parameters in the New constructor and then you can pass them in.
Or
Declare an array in a module then assign it values from your form (data form) , then you can use in the entire proj .
I dun really understand, can u pls show mi some examples..
OK in a module declare this global variable and change number the index of the array to match the number of your actuall data saved to it :
VB Code:
Public Values(3) As String
then , in your first form , assign the values to the array elements consecutively as follow :
VB Code:
Values(0) = "item1" Values(1) = "item2" Values(2) = "item3" Values(3) = "item4"
lastly , since all data reserved in the array and you can call it from anywhere within your proj , call this array from your second form and assign values to textboxes or whatever you will use as so :
VB Code:
TextBox1.Text = Values(0) TextBox2.Text = Values(1) TextBox3.Text = Values(2) TextBox4.Text = Values(3)
I hope this helps .
Thanks, but the datagrid is read from the database one lei. How to set the value?
Try this something like this :
VB Code:
Values(0) = DataGrid1.Item(0, 0) ' First row , first column Values(1) = DataGrid1.Item(0, 1) ' First row , second column Values(2) = DataGrid1.Item(0, 2) ' First row , third column Values(3) = DataGrid1.Item(0, 3) ' First row , forth column