locked
Read MySQL and insert Value to ListBox and more RRS feed

  • Question

  • Hi!

    So need some help here with reading MySQL into an ListBox,

    Table name: users
    | username | test;test1;test2;test3
    | friends | test1;test2;test3
    | online |
    Something like

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click        
    Dim da As New MySqlDataAdapter("select * FROM users WHERE username='test'", con)        
    Dim mytable As New DataTable()
    da.Fill(mytable)        
    lstFriends.DataSource = New BindingSource(mytable, Nothing)        
    lstFriends.DisplayMember = "friends"    
    End Sub
    That works but now it all gets read into 1 line in the ListBox like "test1test2test3", want it to be on 1 line each so when i click on the selected item in the ListBox i want to read that Values MySQL "online" value into a TextBox,

    If "test" is Selected i want to read that "online" value into a Textbox.


    Im realy bad at explaining stuff but hope that works!

    Saturday, August 16, 2014 4:07 PM

Answers