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

C#

 
GeneralRe: Window Position Pin
dbetting10-Oct-04 3:11
dbetting10-Oct-04 3:11 
GeneralRe: Window Position Pin
Stefan Troschuetz10-Oct-04 7:07
Stefan Troschuetz10-Oct-04 7:07 
GeneralWriting hex values to a file Pin
cgcrute9-Oct-04 6:50
cgcrute9-Oct-04 6:50 
GeneralRe: Writing hex values to a file Pin
Heath Stewart9-Oct-04 8:01
protectorHeath Stewart9-Oct-04 8:01 
GeneralRe: Writing hex values to a file Pin
cgcrute10-Oct-04 7:46
cgcrute10-Oct-04 7:46 
GeneralRe: Writing hex values to a file Pin
Heath Stewart10-Oct-04 11:05
protectorHeath Stewart10-Oct-04 11:05 
GeneralAdd dropdownlist to datalist Pin
macsgirl9-Oct-04 6:14
macsgirl9-Oct-04 6:14 
GeneralRe: Add dropdownlist to datalist Pin
Heath Stewart9-Oct-04 7:50
protectorHeath Stewart9-Oct-04 7:50 
Are you asking how to bind this data to a ComboBox? Use a DataAdapter implementation (like SqlDataAdapter, if you're querying a SQL Server RDBMS) and assign the resultant DataSet to ComboBox.DataSource:
// Assume a shared connection object 'conn'
using (SqlCommand cmd = conn.CreateCommand())
{
  cmd.CommandText = "SELECT CM_REF, PM_INDEX, PM_NAME, PM_DESCRIPTION" + 
    "PM_TYPE, PM_CONTENT, PM_DIRECTION, PM_LENGTH FROM TBPARAMETERS";
  DataSet ds = new DataSet();
 
  SqlDataAdapter adapter = new SqlDataAdapter(cmd);
  try
  {
    adapter.Fill(ds);
  }
  catch (Exception ex)
  {
    // Log the exception and display a user-friendly error.
  }
 
  if (ds.Tables.Length == 1)
  {
    comboBox1.DataMember = ds.Tables[0].TableName;
    comboBox1.DataSource = ds;
  }
}
You could also just assign ds.Tables[0] to DataSource, but that can be pretty inflexible in scenarios when you want to related data from the same DataSet in other controls on the form.

If this is not what you're asking, please clarify.

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
GeneralRe: Add dropdownlist to datalist Pin
macsgirl9-Oct-04 8:04
macsgirl9-Oct-04 8:04 
GeneralRe: Add dropdownlist to datalist Pin
Heath Stewart9-Oct-04 11:43
protectorHeath Stewart9-Oct-04 11:43 
GeneralNDoc 1.2 Problems Pin
Kevin McFarlane9-Oct-04 5:12
Kevin McFarlane9-Oct-04 5:12 
GeneralRe: NDoc 1.2 Problems Pin
Colin Angus Mackay9-Oct-04 5:49
Colin Angus Mackay9-Oct-04 5:49 
GeneralRe: NDoc 1.2 Problems Pin
Kevin McFarlane9-Oct-04 6:43
Kevin McFarlane9-Oct-04 6:43 
GeneralRe: NDoc 1.2 Problems Pin
Heath Stewart9-Oct-04 7:41
protectorHeath Stewart9-Oct-04 7:41 
Generalhide form from close button Pin
Mridang Agarwalla9-Oct-04 3:40
Mridang Agarwalla9-Oct-04 3:40 
GeneralRe: hide form from close button Pin
Colin Angus Mackay9-Oct-04 3:56
Colin Angus Mackay9-Oct-04 3:56 
GeneralRe: hide form from close button Pin
Colin Angus Mackay16-Oct-04 6:11
Colin Angus Mackay16-Oct-04 6:11 
GeneralRe: hide form from close button Pin
Anonymous17-Oct-04 0:13
Anonymous17-Oct-04 0:13 
GeneralRe: hide form from close button Pin
Colin Angus Mackay17-Oct-04 1:20
Colin Angus Mackay17-Oct-04 1:20 
Generalwav managing Pin
jeroni_brunet9-Oct-04 3:32
jeroni_brunet9-Oct-04 3:32 
GeneralRe: wav managing Pin
Colin Angus Mackay9-Oct-04 4:07
Colin Angus Mackay9-Oct-04 4:07 
GeneralRe: wav managing Pin
jeroni_brunet9-Oct-04 9:28
jeroni_brunet9-Oct-04 9:28 
GeneralRe: wav managing Pin
Colin Angus Mackay9-Oct-04 9:39
Colin Angus Mackay9-Oct-04 9:39 
GeneralRe: wav managing Pin
jeroni_brunet9-Oct-04 12:09
jeroni_brunet9-Oct-04 12:09 
GeneralRe: wav managing Pin
Colin Angus Mackay9-Oct-04 13:48
Colin Angus Mackay9-Oct-04 13:48 

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.