Results 1 to 5 of 5

Thread: Datagrid click

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2003
    Posts
    3

    Angry Datagrid click

    I have a datagrid that is bound to a dataset. I what my users to be able to
    (1) filter the dataset using their selection from a combobox.(the category is selected from the combobox)
    (2) once filtered and displayed in the grid be able to click on the row and that rows data is displayed in textboxs below the grid.

    The filtering is working fine, the grid is bound to the dataset prior to being filtered so I see all of the data. When I click on a row the data is displayed in the text boxes below the grid. Which is exactly what I want.

    PROBLEM: I select a category (which applys a filter to the dataset) I click a row on the grid..... NO DATA?????????

    Any Direction and or help would be appreicated.

    chuck

  2. #2
    Hyperactive Member D12Bit's Avatar
    Join Date
    Oct 2000
    Location
    Guatemala
    Posts
    373
    what do you have in the click procedure?

    you might have a glitch there, I could help you with your code.
    "Who Dares Wins" - "Quien se Arriesga Gana"
    Mail me at:

  3. #3
    Hyperactive Member D12Bit's Avatar
    Join Date
    Oct 2000
    Location
    Guatemala
    Posts
    373
    Try this:

    VB Code:
    1. Private Sub DataGrid1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2. On Error GoTo ErrHand
    3.     DataGrid1.Row = DataGrid1.RowContaining(Y)
    4.  
    5.     'Personally, If working in the same form I wouldn´t use Me.????? (but that´s me :))
    6.  
    7.     Me.TextBox1.Text = DataGrid1.Columns(0).Text
    8.     Me.TextBox2.Text = DataGrid1.Columns(1).Text
    9.     Me.TextBox3.Text = DataGrid1.Columns(2).Text
    10.     Me.TextBox4.Text = DataGrid1.Columns(3).Text
    11.     Me.TextBox5.Text = DataGrid1.Columns(4).Text
    12.  
    13.     Exit Sub
    14. ErrHand:
    15.     Select Case Err.Number
    16.             Case Is = -2147467259
    17.                 MsgBox "Database Error", vbInformation + vbOKOnly, "Warning"
    18.     End Select
    19. End Sub
    "Who Dares Wins" - "Quien se Arriesga Gana"
    Mail me at:

  4. #4
    New Member
    Join Date
    Nov 2003
    Posts
    8

    Thumbs up

    Thanks D12Bit ,

    Been searching for solutions to solve this same problem as well!!!

  5. #5
    New Member
    Join Date
    Nov 2003
    Posts
    8
    If I use the solution proposed above, I get the whole row highlighted as an indication that it is pointing at that particular
    row, which is good.

    Before I used your solution, I;ve been using the solution as below.

    I use also the move.first,move.last, move.next, move.previous commands because I have 4 buttons that guide the user to point at the particular records, but if I use the buttons to navigate the records displayed in the datagrid, the arrow at the left-most column (known as record selector) of the datagrid will move but it won't highlight the whole selected row.

    I want to standardized everything, which I want the whole selected row to be highlighted but I do not know how to do it. Please help. Thanks in advance


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