User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 422,662 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,683 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums
Views: 1702 | Replies: 3
Reply
Join Date: Jan 2008
Posts: 1
Reputation: 11ta is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
11ta 11ta is offline Offline
Newbie Poster

Question combobox of multiple columns

  #1  
Jan 30th, 2008
hi friends,
i am using visula studio 2005 and database is sql server 2000. i have one table "Designation_Master" with two columns "DesigID" with datatype "smallint" and another "Designation" with datatype "Char(10)". i want to display both column in one row in combobox. i know concate the column. but i don't want to concate two columns. i need seprate two columns in combobox like datagrid or excel. please send a code in "vb" script language not in "c" or "C++"
thank u
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2007
Location: � Jogja �
Posts: 2,584
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Rep Power: 11
Solved Threads: 235
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: combobox of multiple columns

  #2  
Jan 30th, 2008
so what you want it like? you want to show both of data in one combo box or each column for one combo box... maybe you can give the result what you it like to be...
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote  
Join Date: Nov 2007
Location: � Jogja �
Posts: 2,584
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Rep Power: 11
Solved Threads: 235
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: combobox of multiple columns

  #3  
Jan 30th, 2008
i used this to load from sqlserver 2000
Private Sub ReadData()
        Dim i As Integer
        Dim cmdUser As New SqlCommand
        Dim daUser As New SqlDataAdapter
        Dim dsUser As New DataSet
        Dim dtUser As New DataTable
        Dim conn As SqlConnection

        conn = GetConnect()
        Try

            cmdUser = conn.CreateCommand
            cmdUser.CommandText = "SELECT * FROM User"
            daUser.SelectCommand = cmdUser
            daUser.Fill(dsUser, "User")
            dtUser = dsUser.Tables("User")
            For i = 0 To dtUser.Rows.Count - 1
                cmbUserId.Items.Add(dtUser.Rows(i).Item(0))
            Next

        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OKOnly, "Error conection!!")
        End Try
        conn.Close()
    End Sub
call this procedure when form load (form load event)

for note :
cmbUserId.Items.Add(dtUser.Rows(i).Item(0))
this code will adapted with your database, in mydatabase id user in item(0) / first coloumn

ok.
hope this help
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote  
Join Date: Nov 2007
Location: � Jogja �
Posts: 2,584
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Rep Power: 11
Solved Threads: 235
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: combobox of multiple columns

  #4  
Jan 30th, 2008
code above just for one combo box with one column you can change as u want.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb VB.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the VB.NET Forum

All times are GMT -4. The time now is 4:19 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC