This is my code :-
M trying to get these values from database :-
It fetches all the values from the database and bind to combobox easily but when i get the selected value from the combobox it resets the value members i.e. it shows id 1 at admin and 2 at admin2 and 3 at admin3 but the correct values in database is not like that :-O
Any one knows y it is happening ? Please help asap .......... :-O thanks in advance :-)
Dim query As String
Dim ds As New DataSet
Dim dt As New DataTable
Connect.con = Connect.openconnection
query = "Select UserId,UserName From UserMaster"
Dim da As New OdbcDataAdapter(query, Connect.con)
da.Fill(ds, "UserMaster")
dt = ds.Tables("UserMaster")
Dim x As Integer
x = 0
Try
For x = 0 To dt.Rows.Count - 1
CbUsers.Items.Add(dt.Rows(x).Item(1))
CbUsers.ValueMember = dt.Rows(x).Item(0)
Next
Catch ex As OdbcException
MsgBox(ex.ToString)
Finally
Connect.closeconnection()
End Try
M trying to get these values from database :-
UserId UserName 1 admin 3 admin2 5 admin3
It fetches all the values from the database and bind to combobox easily but when i get the selected value from the combobox it resets the value members i.e. it shows id 1 at admin and 2 at admin2 and 3 at admin3 but the correct values in database is not like that :-O
Any one knows y it is happening ? Please help asap .......... :-O thanks in advance :-)