473,394 Members | 1,946 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,394 software developers and data experts.

C# dataset and Combo Box problems

Hi,

Would someone tell me how to fill a dataset into a Combo Box?
I need the ComboBox by default to show the first DataRow from the dataTable.
Thanks for help.
Jason
Nov 17 '05 #1
2 5758
Jason,

\\\
combo.DataSource = dt;
\\or Combobox.DataSource = ds.tables["TheTableName"];
combo.DisplayMember = "theDisplayColumn";
combo.ValueMember = "theValueColumn";
combo.SelectedIndex = 0;
///

If you have problems than it is probably that you set the handler to early
(using the designer). You should add the handler after this.

I hope this helps,

Cor
Nov 17 '05 #2
Thanks Cor for your very fast help!

"Cor Ligthert [MVP]" <no************@planet.nl> ¼¶¼g©ó¶l¥ó·s»D:%2***************@TK2MSFTNGP10.phx. gbl...
Jason,

\\\
combo.DataSource = dt;
\\or Combobox.DataSource = ds.tables["TheTableName"];
combo.DisplayMember = "theDisplayColumn";
combo.ValueMember = "theValueColumn";
combo.SelectedIndex = 0;
///

If you have problems than it is probably that you set the handler to early
(using the designer). You should add the handler after this.

I hope this helps,

Cor

Nov 17 '05 #3

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

Similar topics

3
by: Jane | last post by:
Hello, I am working on a windows application with C#. What I need is to display a list of data in 2nd combo box based on the selection of the 1st combo box. I used SqlCommand object and...
3
by: Dino L. | last post by:
Hi, I have a problem, and I just cant fint a good way to solve it. I have 3 tables in my DB Table1 ------- IDTable1 .... Table2
2
by: resti | last post by:
hi how can i filter my dataset using the value of my combo box thnks
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...
2
by: Jake Smythe | last post by:
Hello, I have a dataset that contains companyid, company name, projectid, project name. I want to bind the dataset to two combo boxes and make the second dependant on the first. So the first...
7
by: Peter | last post by:
Gday, I have a dataset with multiple tables, from which I want to access a single value in one of those tables. I know I can do something like: Decimal myVar =...
5
by: Hetal | last post by:
Hi there.. I am a VB6 developer so kinda trying to figure how to work with VB.NET. I have a scenario where i have a DataSet bound to a combo box, and i would like to read a row from the DataSet...
0
by: Hetal | last post by:
Hi there.. I am a VB6 developer so kinda trying to figure how to work with VB.NET. I have a scenario where i have a DataSet bound to a combo box, and i would like to read a row from the DataSet...
5
by: mydogisbox | last post by:
I have two datasets. One dataset table from dataset1 is bound to a list box. On selection in the list box dataset2 has 9 tables that are populated from the database. these tables are then...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.