CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2000
    Posts
    6

    Selecting Datagrid (Urgent)

    Hi, I need help with some datagrid problems. I'm trying to have my application be able to allow the user to select 1 record on the datagrid and have all the data of that record displayed in a bunch of textboxes. I checked MSDN library and found that "SelBookmarks" sounds pretty similar to what I need. However, I do not quite understand how i can use it. I would appreciate any help. Thanx


  2. #2
    Join Date
    Sep 1999
    Location
    Red Wing, MN USA
    Posts
    312

    Re: Selecting Datagrid (Urgent)

    When the User clicks on the Grid the Record Pointer in the Recordset would have been moved to the desired Record, so just use the values in the Recordset to populate the Textboxes in the RowColChange Event, ie.

    Text1 = ADODC1.Recordset("Field1")
    Text2 = ADODC1.Recordset("Field2")
    Etc..


    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]
    Aaron Young
    Senior Programmer Analyst (Red Wing Software)
    Certified AllExperts Expert

  3. #3
    Join Date
    Feb 2000
    Posts
    6

    Re: Selecting Datagrid (Urgent)

    Sorry I'm still a beginner in VB, so I need some more help. I tried the method Aaron mentioned. But it turned out that whichever record i click to, the textboxes still display the data from a certain record. (For instance, I have 10 records in the datagrid, and no matter which record I click on, the textboxes show the stuff in, let's say, record 5, notice that the display DOES change from any other records to record 5 in the 1st time, but it just stays in record 5 forever). Why is this and how can I solve it? And am I supposed to put the "open connection" statement into the RowColChange Event as well like this?

    Dim cn As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    .
    .
    .
    rs.Open

    And also 1 more thing that maybe related to the problem, is that after I select a record in the datagrid, all of the buttons on my form don't respond (not even the close window button on the top right corner, I have to manually stop the compiling in order to stop the program.)

    Thanx in advance for any help.


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

Featured