Morning all, Hope you can help.

I normally use VB6 for my projects but thought i would look at Visual studio 2010.

I have a windows form with a connection to my sql database which is working fine.
i want to be to select data and input that data into two text boxes.

In vb6 i would put something along the lines of

me.text1.text = RsREmote.fields("Custname")

this would bring through the data in the custname field of my sqldatabase.
how would i do the same in VB.Net?

my code so far is below. hope someone can help

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim con As New SqlConnection
        Dim cmd As New SqlCommand
        Try
            con.ConnectionString = "Data Source=localhost;Initial Catalog=invsystem;Persist Security Info=True;User ID=mbish;Password=mbish"
            con.Open()
            cmd.Connection = con
            cmd.CommandText = "SELECT Customer, Custname FROM Customers Where CustID=1"
            Dim lrd As SqlDataReader = cmd.ExecuteReader()

            While lrd.Read()

            End While

        Catch ex As Exception
            MessageBox.Show("Error while retrieving records on table..." & ex.Message, "Load Records")
        Finally
            con.Close()
        End Try

    End Sub

Afternoon, I managed to get this working with the following code.

Me.TextBox1.Text = Convert.ToString(lrd("customer"))
                Me.TextBox2.Text = Convert.ToString(lrd("CustName"))
                Me.Label1.Text = Convert.ToString(lrd("Custid"))
This question has already been answered. Start a new discussion instead.