Results 1 to 2 of 2

Thread: load recordset into textboxes

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2010

    load recordset into textboxes

    hi guys,

    I am working on a proyect and i got stucked,

    The thing is i have a form which contains a datagrid, and a group of txtboxes
    I load information into the datagrid through a recorset called rsservices that uses a db table in informix ( i work with adodb connection and adodb recordsets)
    and it works fine.
    Then when you click in a record into the datagrid i want it to display the information of the row selected into the textboxes , there are like 5 textboxes each one shows a different info of the same row.

    ex : row = Name, last name, address, gender, id etc

    but i failed doing that

    what I tried was, in the activated event of the form :

            If rsservices.State = 1 Then
            End If
            rsservices = Nothing
            sql = "select * from services"
            rsservices = cn.Execute(sql)
            datagrid.DataSource = rsservices
            'then here i match the database fields with the form textboxes
             ex: txtname.text = rsservices("name").value
            end sub
    after i do all that and run the program the thing loads the first row into the textboxes but when i try to select another row from the datagrid it does nothing

    somebody can help me please ??

  2. #2
    Junior Member
    Join Date
    Sep 2010

    Re: load recordset into textboxes

    I dont know much about SQL in visual basic, but why not try a "For Each" statement

    For Each VariableName As ObjectType In CollectionOfSomeSorts
    'Code for what to do to VariableName. VariableName will = ObjectType. the 'As' arg is optional

    If you dont know what type of object it is, try this

    For Each VariableName In CollectionInSomeSorts
    'Code for what to do to VariableName. VariableName will be a String or Object (depending on the collection type)

Tags for this Thread

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