Click here to Skip to main content
15,914,488 members
Home / Discussions / C#
   

C#

 
GeneralRe: generate rtf code of pictures/images Pin
je_gonzalez5-Apr-04 12:44
je_gonzalez5-Apr-04 12:44 
GeneralRe: generate rtf code of pictures/images Pin
Jay Shankar5-Apr-04 15:15
Jay Shankar5-Apr-04 15:15 
GeneralComponent Properties Pin
dbetting4-Apr-04 17:57
dbetting4-Apr-04 17:57 
GeneralRe: Component Properties Pin
Heath Stewart4-Apr-04 18:10
protectorHeath Stewart4-Apr-04 18:10 
GeneralRe: Component Properties Pin
dbetting5-Apr-04 10:06
dbetting5-Apr-04 10:06 
GeneralRe: Component Properties Pin
Heath Stewart5-Apr-04 10:34
protectorHeath Stewart5-Apr-04 10:34 
QuestionGenerating listbox based on dataset? Pin
MeterMan4-Apr-04 17:45
MeterMan4-Apr-04 17:45 
AnswerRe: Generating listbox based on dataset? Pin
Heath Stewart4-Apr-04 18:06
protectorHeath Stewart4-Apr-04 18:06 
See the ListControl.DataSource property documentation in the .NET Framework SDK, from which the ListBox derives. This has nothing to do with SQL itself. Once you get a DataSet that contains your data from a database (or other OLE DB or ODBC source), then it's simple:
listBox1.DataSource = ds; // your DataSet instance
listBox1.DataMember = "MyTable"; // your table name
listBox1.DisplayMember = "Name"; // column name for display data
listBox1.ValueMember = "ID"; // column name for value data
You can set the last three initially after you instantiate the ListBox (called listBox1 in this simple example). You can set DataSource at any time when you get data to fill the ListBox. You do not have to re-create it or anything, just re-assign a new DataSet (or other data source, like an array or a collection - anything that implements IList or IListSource).

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: Generating listbox based on dataset? Pin
MeterMan4-Apr-04 19:09
MeterMan4-Apr-04 19:09 
GeneralRe: Generating listbox based on dataset? Pin
MeterMan5-Apr-04 10:41
MeterMan5-Apr-04 10:41 
GeneralRe: Generating listbox based on dataset? Pin
Heath Stewart5-Apr-04 10:46
protectorHeath Stewart5-Apr-04 10:46 
GeneralRe: Generating listbox based on dataset? Pin
MeterMan5-Apr-04 11:03
MeterMan5-Apr-04 11:03 
GeneralRe: Generating listbox based on dataset? Pin
MeterMan5-Apr-04 14:37
MeterMan5-Apr-04 14:37 
GeneralRe: Generating listbox based on dataset? Pin
Heath Stewart5-Apr-04 17:20
protectorHeath Stewart5-Apr-04 17:20 
GeneralRe: Generating listbox based on dataset? Pin
MeterMan5-Apr-04 18:27
MeterMan5-Apr-04 18:27 
GeneralRe: Generating listbox based on dataset? Pin
Heath Stewart5-Apr-04 18:34
protectorHeath Stewart5-Apr-04 18:34 
GeneralRe: Generating listbox based on dataset? Pin
MeterMan5-Apr-04 21:14
MeterMan5-Apr-04 21:14 
GeneralChanging menu bars color Pin
MeterMan4-Apr-04 16:34
MeterMan4-Apr-04 16:34 
GeneralRe: Changing menu bars color Pin
Heath Stewart4-Apr-04 18:00
protectorHeath Stewart4-Apr-04 18:00 
GeneralRe: Changing menu bars color Pin
MeterMan4-Apr-04 19:09
MeterMan4-Apr-04 19:09 
GeneralMaking menu Item bring and kill focus Pin
MeterMan4-Apr-04 16:28
MeterMan4-Apr-04 16:28 
GeneralRe: Making menu Item bring and kill focus Pin
Heath Stewart4-Apr-04 17:52
protectorHeath Stewart4-Apr-04 17:52 
GeneralRe: Making menu Item bring and kill focus Pin
MeterMan4-Apr-04 19:12
MeterMan4-Apr-04 19:12 
GeneralRe: Making menu Item bring and kill focus Pin
Heath Stewart4-Apr-04 19:18
protectorHeath Stewart4-Apr-04 19:18 
GeneralRe: Making menu Item bring and kill focus Pin
LongRange.Shooter5-Apr-04 9:18
LongRange.Shooter5-Apr-04 9:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.