•
•
•
•
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
![]() |
•
•
Join Date: Jan 2008
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
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
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
•
•
Join Date: Nov 2007
Location: � Jogja �
Posts: 2,584
Reputation:
Rep Power: 11
Solved Threads: 235
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 *
So, Please do something before post your thread.
* PM Asking will be ignored *
•
•
Join Date: Nov 2007
Location: � Jogja �
Posts: 2,584
Reputation:
Rep Power: 11
Solved Threads: 235
i used this to load from sqlserver 2000
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
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 Subfor 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 *
So, Please do something before post your thread.
* PM Asking will be ignored *
•
•
Join Date: Nov 2007
Location: � Jogja �
Posts: 2,584
Reputation:
Rep Power: 11
Solved Threads: 235
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 *
So, Please do something before post your thread.
* PM Asking will be ignored *
![]() |
•
•
•
•
•
•
•
•
DaniWeb VB.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Previous Thread: Connect two forms using a button
- Next Thread: smallest interval timer offers



Linear Mode