473,396 Members | 2,010 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,396 software developers and data experts.

Binding dataset to a ListBox.

Hi,

In ASP.Net C# windows form, how do I bind a DataSet to a ListBox so the
ListBox will display data?
Thanks for help.

Jason
Nov 17 '05 #1
4 2925
"Jason Huang" <Ja************@hotmail.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
In ASP.Net C# windows form


ASP.NET uses WebForms, not WinForms.

Are you talking about binding a datasource to an <asp:ListBox /> WebControl
on an ASPX page?

Please clarify...
Nov 17 '05 #2
"Jason Huang" <Ja************@hotmail.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
In ASP.Net C# windows form


ASP.NET uses WebForms, not WinForms.

Are you talking about binding a datasource to an <asp:ListBox /> WebControl
on an ASPX page?

Please clarify...
Nov 17 '05 #3
listBoxName.DataSource = DataSet.Tables[TableIndex];
listBoxName.DataTextField = "FieldName";
listBoxName.DataValueField = "FieldName";
listBoxName.DataBind();
"Jason Huang" <Ja************@hotmail.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
Hi,

In ASP.Net C# windows form, how do I bind a DataSet to a ListBox so the
ListBox will display data?
Thanks for help.

Jason

Nov 17 '05 #4
listBoxName.DataSource = DataSet.Tables[TableIndex];
listBoxName.DataTextField = "FieldName";
listBoxName.DataValueField = "FieldName";
listBoxName.DataBind();
"Jason Huang" <Ja************@hotmail.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
Hi,

In ASP.Net C# windows form, how do I bind a DataSet to a ListBox so the
ListBox will display data?
Thanks for help.

Jason

Nov 17 '05 #5

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

Similar topics

3
by: me | last post by:
I've included a picture below to show what I am trying to accomplish. It is best to copy/paste into notepad to get the spacing correct. I have a dataset that contains 3 tables. Two of the tables...
10
by: ShadowsOfTheBeast | last post by:
hi all i am trying to bind data to my datagrid from a listbox which i think it should work but an error is coming up saying i have to bind to a datasource that implements the Inumerable or...
0
by: Federico Bari | last post by:
Hi all, I have popolate a listbox using a table of a dataset; but i'm not able to bind the selected value of the listbox to another table record. What I need is to bind the value of the clicked...
3
by: Scott | last post by:
I'm trying to bind my listbox to a SQL query like this: using (SqlConnection conn = new SqlConnection(CONN_STR)) { using (SqlDataAdapter da = new SqlDataAdapter("roboticSiteNames", conn)) {...
8
by: Richard L Rosenheim | last post by:
I have a dataset containing a parent table related to a child table. The child table contains an ID field (which is configured as autonumber in the datatable), the ID of the parent, plus some...
3
by: Peter | last post by:
OK, so in addition to the problem I mentioned before (c.f. "Data Binding to Textbox"), I realized that my comboboxes are not really bound to the internal data set. They are just set to manually...
0
by: derndeh | last post by:
I am using VS 2003. I have two tables, BookOrders and BookInfo. BookOrders holds order info which would contain a book Id. Book info will contain the details such as a books title. I want to...
4
chathura86
by: chathura86 | last post by:
Hi i have bounded a dataset to a listbox and i want to get the selected values when i clicked add and write them to a text box. here is the code i'v used Imports System.Data.SqlClient Public...
4
by: Arch Stanton | last post by:
I'm trying to bind data in a dataset (obtained from an Access DB) to a listbox in ASP.net. I know my dataset is being created properly because it displays fine in a datagrid, but I can't get it to...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.