VB.NET

Moderators: seancampbell
Number of threads: 4020
Number of posts: 10026

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
how to get the first item in combobox Posted by nanologic on 30 Sept 2011 at 4:10 AM
hello, i have a problem with combobox,
this is my 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
        conn.Close()
End Sub


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

result in combobox
1/Injection
2/Warehouse
3/Maintenance

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.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.