how to get the first item in combobox - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

how to get the first item in combobox

nanologicnanologic Posts: 1Member
hello, i have a problem with combobox,
this is my code.

[code]Private Sub LoadDept()
conn = New SqlConnection("Data Source=EXCO-2B41B5;Initial Catalog=payroll;Integrated Security=True")
cmdUser = conn.CreateCommand
cmdUser.CommandText = "select * from department order by number asc"
daUser.SelectCommand = cmdUser
daUser.Fill(dsUser, "department")
dtUser = dsUser.Tables("department")
For i = 0 To dtUser.Rows.Count - 1
cmbDept.Items.Add("" & dtUser.Rows(i).Item(0) & "/" & dtUser.Rows(i).Item(1) & "")
Next i
End Sub[/code]

dtUser.Rows(i).Item(0) = first field in my table is "number"
dtUser.Rows(i).Item(1) = second field "division"

result in combobox

my question is how to insert into database, but the value it just the Item(0) "number" . not both.

Any kind of help would be appreciated.
Sign In or Register to comment.