473,804 Members | 2,931 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

list box fill

How to Fill a listbox with data from database?

Hrcko
Nov 17 '05 #1
3 5690
Hi,

What particular type of list box is it? What is the datasource (DataSet,
DataReader, etc.)?
Typically you can databind a listbox control to a DataTable instance,
specifying which column to use as the 'key' and which as the value to be
displayed.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Hrvoje Voda" <hr*********@lu atech.com> wrote in message
news:d3******** **@ss405.t-com.hr...
How to Fill a listbox with data from database?

Hrcko


Nov 17 '05 #2
It is a normal listBox control and I would like to fill it through dataset.
"Dmytro Lapshyn [MVP]" <x-****@no-spam-please.hotpop.c om> wrote in message
news:uL******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

What particular type of list box is it? What is the datasource (DataSet,
DataReader, etc.)?
Typically you can databind a listbox control to a DataTable instance,
specifying which column to use as the 'key' and which as the value to be
displayed.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Hrvoje Voda" <hr*********@lu atech.com> wrote in message
news:d3******** **@ss405.t-com.hr...
How to Fill a listbox with data from database?

Hrcko

Nov 17 '05 #3
For a Windows Forms code sample, please refer to the DataSource property
MSDN documentation for the System.Windows. Forms.ListBox class.
For a Web Forms list box, the approach is similar, but the names of
properties for the display member and the value member are different.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Hrvoje Voda" <hr*********@lu atech.com> wrote in message
news:d3******** **@ss405.t-com.hr...
It is a normal listBox control and I would like to fill it through
dataset.
"Dmytro Lapshyn [MVP]" <x-****@no-spam-please.hotpop.c om> wrote in message
news:uL******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

What particular type of list box is it? What is the datasource (DataSet,
DataReader, etc.)?
Typically you can databind a listbox control to a DataTable instance,
specifying which column to use as the 'key' and which as the value to be
displayed.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Hrvoje Voda" <hr*********@lu atech.com> wrote in message
news:d3******** **@ss405.t-com.hr...
How to Fill a listbox with data from database?

Hrcko



Nov 17 '05 #4

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

Similar topics

19
2610
by: David Abrahams | last post by:
Can anyone explain the logic behind the behavior of list slicing with negative strides? For example: >>> print range(10) I found this result very surprising, and would just like to see the rules written down somewhere. Thanks,
8
2870
by: ma740988 | last post by:
Consider: # include <iostream> using std::cout; using std::cin; using std::endl; # include <list> using std::list;
1
2920
by: John | last post by:
Hi, we have the following problem: in our application v1.0 we have static html pages (+ some javascript). With a CMS (a Content Management System) some "mortal" people can add or expand the available images for the start site. The site loads randomly an image or a Flash animation (if the flash plugin is present) through a javascript and each time the start site loades and displays only 1 different picture. At the moment the name of...
3
12062
by: ali poursadri | last post by:
Hi, I want to fill my list box from a dataset in c#. I use adapter and fill command and bind it to a listbox, but it is very slow for large data about 500000 records. How can I view this list rapid? thanks.
13
11324
by: Hrvoje Voda | last post by:
How to put a specified dataset table into an array list ? Hrcko
0
3244
by: Brian Henry | last post by:
Here is another virtual mode example for the .NET 2.0 framework while working with the list view. Since you can not access the items collection of the list view you need to do sorting another way... here is my code on how I did it to help anyone starting out get an idea of how to use virtual mode in ..NET 2.0 Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared
22
8050
by: joshc | last post by:
In an interview for an embedded software position recently I was asked to write code, in C, for printing the contents of a linked list backwards. After a few minutes I came up with the recursive solution. Being that recursion is frowned upon in embedded software, the answer was not what the interviewer expected, but alas it was correct. I asked some friends how they would have answered and another answer is to reverse the list and then...
3
1249
by: Fendi Baba | last post by:
I faced 2 isseues. First, I created three (3) dropdown list on my page. They are populated by an event triggered in the page load command. What's strange is that the frist drop downlist gets populated as expected but the second and third do not get populated at all. I dont think I made any mistake but can anyone verfiy if I made an error somewhere? here is my onload code:
1
1347
by: Boheim | last post by:
I have two controls on my page: 1) A list box 2)A drop down list I want my users to be able to select from the drop down list and the related data be shown in the list box. For example: lets say the data in the combo box were the names of various students. I want the users to select a student name and then their classes be listed in the list box. Ok. This is my code so far.
6
11753
by: badcrusher10 | last post by:
Hello. I'm having trouble figuring out what to do and how to do.. could someone explain to me what I need to do in order to work? THIS IS WHAT I NEED TO DO: Professor Snoop wants a program that will randomly generate 10 unique random numbers. Your job is to write a program that produces random permutations of the numbers 1 to 10. “Permutation” is a mathematical name for an arrangement. For example, there are six permutations of the...
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10569
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10315
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10075
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9140
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.