473,398 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Complex Bind Combo Box VB.Net

I am new to VB.NET and I am trying to use a complex bind for a combo
box. I have successfully created a data set, I have set my DataSource
value to the dataset and the DisplayMember value to the field in the
dataset I wish to utilize. When I run the form the combo box has no
information. What am I doing wrong?

Thanks!!
Travis
Nov 20 '05 #1
2 6941
Hi,

You should use a datasource of dataset.table.

Here is an example Assumes you import system.data.oledb

Dim conn As OleDbConnection

Dim strConn As String

Dim strSQL As String

Dim da As OleDbDataAdapter

strConn = "Provider = Microsoft.Jet.OLEDB.4.0;"

strConn += "Data Source = Northwind.mdb;"

conn = New OleDbConnection(strConn)

da = New OleDbDataAdapter("Select * From Categories", conn)

da.Fill(ds, "Categories")

ComboBox1.DataSource = ds.Tables("Categories")

ComboBox1.DisplayMember = "CategoryName"

Ken
--------------------
"Travis" <su*****@dekatechnologies.com> wrote in message
news:15**************************@posting.google.c om...
I am new to VB.NET and I am trying to use a complex bind for a combo
box. I have successfully created a data set, I have set my DataSource
value to the dataset and the DisplayMember value to the field in the
dataset I wish to utilize. When I run the form the combo box has no
information. What am I doing wrong?

Thanks!!
Travis

Nov 20 '05 #2
Cor
Hi Travis,

You have to set the datasource to a dataset table when you use a dataset not
the dataset itself.
something as
\\\
combobox1.datasource = dataset.tables("mytable")
///

I hope this helps,

Cor
I am new to VB.NET and I am trying to use a complex bind for a combo
box. I have successfully created a data set, I have set my DataSource
value to the dataset and the DisplayMember value to the field in the
dataset I wish to utilize. When I run the form the combo box has no
information. What am I doing wrong?

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

34
by: Pmb | last post by:
I've been working on creating a Complex class for my own learning purpose (learn through doing etc.). I'm once again puzzled about something. I can't figure out how to overload the assignment...
2
by: Ken Powers | last post by:
Hello everyone, I'm getting a strange error when I try to bind a combo box to a Dataset. Here's my code! Private Sub Get_Data() Try Dim sqlcmd = New SqlCommand("Select * from Utility order...
0
by: Ken Powers | last post by:
Hello everyone, Sorry about the repost, my second VB.NET App is done with the exception of this error. I'm getting a strange error when I try to bind a combo box to a Dataset. Here's my code! ...
4
by: Steve | last post by:
C# I have some combo boxes, full of lookup descriptions. When I retrieve a dataset for my record, the values that need binding to the combos are the actual record IDs that relate to these...
0
by: Kobe | last post by:
I am trying to bind data in a collection to a combo box in a windows application. I am able to retrieve records from the collection but when I bind it to the combo box, nothing is displayed ...
2
by: Random | last post by:
I have a very full and complex object that contains objects as properties and a few collections, and I'm working to databind it to a page. A lot of textbox and dropdowns on the page, a few grids. ...
1
by: svchosthunter | last post by:
I want to bind a gridview with data table but I need one field as combo box as DataGridviewComboBoxColumn I want that when I bind my grid there should be a combo box in grid which will be binded to...
0
by: dudeja.rajat | last post by:
Hi, I'm using Tkinter and Tix. I've created a combo box which I am able to fill it up. I'm want to call a function as soon as user selects some thing from the combo box. More precisely, I want...
0
by: dudeja.rajat | last post by:
Hi, I'm a newbie and created a new combo box with Tix. The combo box is filled with the required items. I've used Tkinter's listbox and used the <ListboxSelectevent and bind that with a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.