Results 1 to 10 of 10

Thread: collecting data from datagrid and pull it to other commands

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Posts
    175

    Unhappy collecting data from datagrid and pull it to other commands

    i want to identify selected row in datagrid and populate few textboxes with the appropriate data from the dataview/datagrid which connected to a datagrid how can i do that?

    i have the folowing event

    rivate Sub grdCompanies_Navigate(ByVal sender As System.Object, ByVal ne As System.EventArgs) Handles grdCompanies.DoubleClick


    **which code should i put here so when the user double click on a row i get the appropriate data from the dataview and pull it to textbox


    End Sub

    thanks for help

  2. #2
    Registered User
    Join Date
    Nov 2002
    Location
    Växjö, Sweden
    Posts
    314
    DataGrid1.CurrentRowIndex gives you the current row index. Use that with your DataView object. Something like this maybe....

    dv.Item(DataGrid1.CurrentRowIndex)("ColumnName")

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Posts
    175
    thanks for the answer
    what happen if i filter the grid? the indexes wont be the same no?

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Posts
    175
    i made the datagrid rowselection as the entire row - my problem is when i filter the row i want to go get the appropriate value and input it to some commads - how do i do that?

  5. #5
    Registered User
    Join Date
    Nov 2002
    Location
    Växjö, Sweden
    Posts
    314
    The index will in most cases probably not be the same, but the row you are doubleclicking is the one with CurrentRowIndex, and as I understand it you want data from the row you doubleclicked to pop into textboxes, ie the one with CurrentRowIndex, right?

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Posts
    175
    yup i just need the record data - but i had additional data which exists in the dataview and not in the grid

  7. #7
    Lively Member
    Join Date
    Jul 2003
    Posts
    93
    Did you ever solve this? I'm having a similar problem & can't figure it out.

  8. #8
    Lively Member
    Join Date
    Nov 2002
    Location
    Malaysia
    Posts
    124

    Binding Context

    You should have a BindingContext Command in
    Private Sub grdCompanies_Navigate(ByVal sender As System.Object, ByVal ne As System.EventArgs) Handles grdCompanies.DoubleClick

    Let me know if you have bindingcontext problem.

  9. #9
    Lively Member
    Join Date
    Jul 2003
    Posts
    93
    How would I use the bindingcontext command? Can you provide an example?

    Thanks

  10. #10
    Lively Member
    Join Date
    Nov 2002
    Location
    Malaysia
    Posts
    124
    VB Code:
    1. Private Sub datListSetting_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles datListSetting.Click
    2.         Me.BindingContext(DataSet11, "DatabaseTableName").Position = datListSetting.CurrentRowIndex
    3.     End Sub

    set the each textbox's properties , databinding.text = dataset's datafield.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width