Get lastname from database and populate textboxes no binding

I wrote a form in which you enter lastname and then should return data and populate textboxes I know that I created a sub that grab's lastname but I don't know how to return that dataset into a new function

app look
here is what I wrote
Imports System.Data
Imports System.Data.SqlClient
Imports System.Windows.Forms
Imports System.Data.SqlDbType
Public Class LastnameSelectNCCA
    Public sql As String
    Public ds As New DataSet
    Public stgnccapath As String = "\\tsnfps01\webdev\branding\tompowers\College Football logos\"
    Public connetionString As String
    Public connection As SqlConnection
    Public adapter As SqlDataAdapter
    Public objDataReader As SqlDataReader
    Public SelectCommand As New SqlCommand
    Public intLast As Integer
    Public Sub GetNccaplayers()

        connetionString = "Data Source=tsnappdev01;Initial Catalog=TSN2;User ID=sa;Password=XXXXXXXXX"
        connection = New SqlConnection(connetionString)



        sql = "SELECT FirstName, LastName,Position,College,Class,TeamID,PlayerID"

        sql += " FROM NCAA_FB_PLAYERS  WHERE"
        sql += " STATUS ='A' AND FIRSTNAME <>'Team' AND Lastname like '%" & _
                txtLastname.Text & "%'" & "ORDER BY LastName DESC"

        Try
            connection.Open()
            adapter = New SqlDataAdapter(sql, connection)
            adapter.SelectCommand.Parameters.AddWithValue("@Lastname", txtLastname.Text)

            adapter.Fill(ds)
            connection.Close()

        Catch ex As SqlException
            MsgBox(ex.ToString)
        End Try

        LoadData()
    End Sub
    Public Sub LoadData()


        connetionString = "Data Source=tsnappdev01;Initial Catalog=TSN2;User ID=sa;Password=sportsrus"
        connection = New SqlConnection(connetionString)
        Dim intLast As Integer = txtPlayerID.Text

        Try
            Dim SqlCommand = New SqlCommand
            Dim objCommand = New SqlCommand

            'Set the objCommand object properties
            objCommand.CommandText = "SelectID"
            objCommand.CommandType = CommandType.StoredProcedure
            objCommand.Connection = connection

            'Add the required parameter for the query
            '        objCommand.Parameters.Add("@ID", OleDbType.Guid, 16).Value = _
            '           New Guid(ComboBox1.SelectedValue.ToString)
            objCommand.Parameters.Add("@PlayerID", SqlDbType.Int, 32).Value = CInt(intLast)
            Dim objDataReader As SqlDataReader
            'Execute the Query
            objDataReader = objCommand.ExecuteReader()

            'If we have data then display the project description
            If objDataReader.HasRows Then
                objDataReader.Read()
                txtFirst.Text = objDataReader.Item("Firstname")
                txtLast.Text = objDataReader.Item("Lastname")
                Position.Text = objDataReader.Item("Position")
                txtCollege.Text = objDataReader.Item("College")
                txtClass.Text = objDataReader.Item("Class")
                txtTeamID.Text = objDataReader.Item("TeamID")
                txtPlayerID.Text = objDataReader.Item("PlayerID")
               

            End If
        Catch sqlExceptionErr As SqlException
            MessageBox.Show(sqlExceptionErr.Message)
        End Try

        objDataReader.Close()
        connection.Close()

       
    End Sub

    Private Sub btnexit_Click(sender As Object, e As EventArgs) Handles btnexit.Click
        Me.Close()
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
       
        picNCAATeam.ImageLocation = stgnccapath & txtTeamID.Text & ".jpg"
    End Sub

    
    Private Sub btnselectLastname_Click(sender As Object, e As EventArgs) Handles btnselectLastname.Click
        If txtLast.Text = "" Then
            Exit Sub
        Else

            GetNccaplayers()
        End If
    End Sub
End Class

Open in new window

Thanks EE
powerztomAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SStoryCommented:
After call to
            GetNccaplayers()

Put the ds values in the text boxes.

if ds isnot nothing andalso ds.tables(0).rows.count>0 then
        dim row as DataRow=ds.Tables(0).Rows(0)
       
                txtFirst.Text = row.item(0).toString()
                txtLast.Text = row.item(1).toString()

'etc.
'increment the item index 0,1,2,3, etc.
end if
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
powerztomAuthor Commented:
SStory Thank you just what I needed to see. Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.