Hai....
Im new to .net ,I need help in doing my project....
If i Give the lastname in textbox then the items in lastname should be displayed in the anthor textbox
For ex :
Thomus,123,aaa
Thomus,345,bbb
H_alert,456,ccc

If i enter thomus it should show all thomus from my database but its not working...only one item is displaying in the textbox....
fro ex:
thomus,123,aaa

I set textbox mode as multiple line

please help me ...what to do...
i used this code its showing only one item....

mycon.Open()
        Dim myCmd As New SqlCommand
        myCmd.CommandText = "SELECT * FROM agent where Lastname='" & Me.TextBox2.Text.Trim() & "'"
        myCmd.Connection = mycon
        Dim i As Integer
        Try
            Dim y As SqlDataReader
            y = myCmd.ExecuteReader()
            i = 0
            While y.Read
                TextBox9.Text = (y.GetValue(1) & vbCrLf & y.GetValue(3) & vbCrLf & y.GetValue(2))          
  End While
            y.Close()
        Catch ex As Exception
            Label1.Text = ex.Message
        Finally

            mycon.Close()
            myCmd.Dispose()
        End Try

thanks in advance...
:(

Hi Yookify
Try This
Replace This line
TextBox9.Text = (y.GetValue(1) & vbCrLf & y.GetValue(3) & vbCrLf & y.GetValue(2))

By This
TextBox9.Text = TextBox9.Text & (y.GetValue(1) & "," & y.GetValue(3) & "," & y.GetValue(2) & vbCrLf )

Hope You get what you asked

Hi Yookify
Try This
Replace This line
TextBox9.Text = (y.GetValue(1) & vbCrLf & y.GetValue(3) & vbCrLf & y.GetValue(2))

By This
TextBox9.Text = TextBox9.Text & (y.GetValue(1) & "," & y.GetValue(3) & "," & y.GetValue(2) & vbCrLf )

Hope You get what you asked

I cant Believe it yar....I tried a lot used more codings but i cant get answ...
now im so happy ...Thak you ....Its very very smiple...Oh Thanks yar Really Thanks A Lot :):-O:P

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.