Results 1 to 3 of 3

Thread: [RESOLVED] Datagrid double click

Hybrid View

  1. #1
    Junior Member
    Join Date
    Aug 12
    Posts
    31

    Resolved [RESOLVED] Datagrid double click

    Hello,

    I searched google and the forums to try find a good tutorial or example but was not able to!

    I have a form called ViewUsersGrid.vb and there is a datagridview1 in there. This uses the SQL cmd to fill the datagrid select firstname,lastname from users etc.

    This then fills the grid with the information, now I want to use the datagrid doubleclick event, to double click a row to show viewuser.vb which I can do, but I want it then to fill the empty text fields with the information for that user I have double clicked on.

    Thanks.

    Datagridview.vb code

    Code:
    Dim connection As New SqlClient.SqlConnection
            Dim command As New SqlClient.SqlCommand
            Dim adaptor As New SqlClient.SqlDataAdapter
            Dim AID As String = AgentIDNum.AgentIDNumber
    
            Dim dataset As New DataSet
    
            connection.ConnectionString = "Data Source=ANDY-PC\LETTINGS;Initial Catalog=easylet_database;User Id=sa;Password=g3m1n1;"
            command.CommandText = "Select Title, FirstName, LastName, Telephone, Telephone2, Email from Users"
            connection.Open()
    
            command.Connection = connection
    
            adaptor.SelectCommand = command
    
            adaptor.Fill(dataset, "MyTable")
            DataGridView1.DataSource = dataset.Tables("MyTable").DefaultView
    I also have a save button in the viewusers form, so once its loaded into the new form I want to say change the password and click save and its save it.

    cheers.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 05
    Location
    Sydney, Australia
    Posts
    80,868

    Re: Datagrid double click

    Follow the CodeBank link in my signature and check out my thread on Editing A Grid Row In A Dialogue.

  3. #3
    Junior Member
    Join Date
    Aug 12
    Posts
    31

    Re: Datagrid double click

    Cant see that thread vb.net code bank?

Posting Permissions

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