Moving Data from one form to another
-
i want to copy the data that exists on a gridview column to another form 's listbox >>>> can you help me
-
i want to copy the data that exists on a gridview column to another form 's listbox >>>> can you help me
I would suggest using any type of loop (Do While, For Next etc), what ever you like to get the data from the DataGridView column. Just get the number of rows you wish to copy then loop through the rows, either storing the data returned into the ListBox or populating an Array, which can then be used to fill the ListBox. Note in the example below data is returned from the first column. Dim pInt As Integer Dim pIntItems As Integer Dim pStrValue as String (or what ever the value type of the column is) pIntItems = DataGridView.RowCount For pInt = 0 To pIntItems - 1 pStrValue = DataGridView.Rows(pInt).Cells(0).Value "Now either store this value to an array or make a function call to start populating the ListBox with the value." Next Hope this helps
-
I would suggest using any type of loop (Do While, For Next etc), what ever you like to get the data from the DataGridView column. Just get the number of rows you wish to copy then loop through the rows, either storing the data returned into the ListBox or populating an Array, which can then be used to fill the ListBox. Note in the example below data is returned from the first column. Dim pInt As Integer Dim pIntItems As Integer Dim pStrValue as String (or what ever the value type of the column is) pIntItems = DataGridView.RowCount For pInt = 0 To pIntItems - 1 pStrValue = DataGridView.Rows(pInt).Cells(0).Value "Now either store this value to an array or make a function call to start populating the ListBox with the value." Next Hope this helps
Hello, 1.Get all the data from gridview into some (public static)variables. 2.In the form where u want those values just write the form name of gridview values followed by the value property of list box. EX. Form.Listboxproperty thanks.