Click here to Skip to main content
15,920,633 members
Home / Discussions / Windows Forms
   

Windows Forms

 
AnswerRe: Which DataGridView event for persisting changes? Pin
led mike24-Jun-08 9:59
led mike24-Jun-08 9:59 
GeneralRe: Which DataGridView event for persisting changes? Pin
Brady Kelly24-Jun-08 10:07
Brady Kelly24-Jun-08 10:07 
GeneralRe: Which DataGridView event for persisting changes? Pin
led mike24-Jun-08 11:37
led mike24-Jun-08 11:37 
GeneralRe: Which DataGridView event for persisting changes? Pin
Brady Kelly24-Jun-08 11:47
Brady Kelly24-Jun-08 11:47 
QuestionEncoding Mp3 File while uploading to FTP Server Pin
catchcnu22-Jun-08 22:01
catchcnu22-Jun-08 22:01 
Questionmodifying scroll box controls using compact framework SDK Pin
neilfed222-Jun-08 9:15
neilfed222-Jun-08 9:15 
GeneralComboBox in DataGridView Pin
Brady Kelly22-Jun-08 6:16
Brady Kelly22-Jun-08 6:16 
GeneralRe: ComboBox in DataGridView Pin
John_Adams23-Jun-08 4:22
John_Adams23-Jun-08 4:22 
Hi,

DataGridView gives us the ComboBox column type to attach a dropdown box in a column. Below is the code snippets for the same:

BEGIN CODE

DataGridViewComboBoxColumn colGender = new
DataGridViewComboBoxColumn();

// Size the column width so it is wide enough to display the
header

colGender.AutoSizeMode =
DataGridViewAutoSizeColumnMode.ColumnHeader;
colGender.DataPropertyName = "Gender";
// Specifiy the list of choices in the combo box
colGender.Items.AddRange(new string[] { "M", "F" });
// Sort the combo box contents alphabetically
colGender.Sorted = true;
// Disable sorting for the column
colGender.SortMode = DataGridViewColumnSortMode.NotSortable;
colGender.HeaderText = "Gender";
colGender.Name = "Gender";
colGender.ReadOnly = false;
dataGridView2.Columns.Add(colGender);

//
// Column: Marital status, combo box
//
// For this column, combo box contents are retrieved from the
database
DataGridViewComboBoxColumn colMaritalStatus = new
DataGridViewComboBoxColumn();
// Size the column width so it is wide enough to display the
header
colMaritalStatus.AutoSizeMode =
DataGridViewAutoSizeColumnMode.ColumnHeader;
colMaritalStatus.DataPropertyName = "MaritalStatus";
// Retrieve the list of choices from the database
colMaritalStatus.DataSource =
dataSetAdventureWorks.Tables["MaritalStatusChoices"];
// Identify the column in the Employee table that is used to
select the combo box item
colMaritalStatus.ValueMember = "MaritalStatus";
// If the column value is not human friendly, e.g., a foreign
key identity off to a related table,
// the DisplayMember property is used to identify the column
used for display purposes
colMaritalStatus.DisplayMember = "MaritalStatus";
colMaritalStatus.HeaderText = "Marital Status";
colMaritalStatus.Name = "MaritalStatus";
colMaritalStatus.ReadOnly = false;
dataGridView2.Columns.Add(colMaritalStatus);
END CODE

Hope this helps Smile | :)

Regards,
John Adams
ComponentOne LLC

QuestionOpen a windows form one project in other project Pin
C4ao521-Jun-08 7:40
C4ao521-Jun-08 7:40 
AnswerRe: Open a windows form one project in other project Pin
Christian Graus21-Jun-08 15:40
protectorChristian Graus21-Jun-08 15:40 
GeneralRe: Open a windows form one project in other project Pin
C4ao522-Jun-08 0:35
C4ao522-Jun-08 0:35 
QuestionHow to stop updating a PictureBox? [modified] Pin
MichaelCoder20-Jun-08 10:18
MichaelCoder20-Jun-08 10:18 
AnswerRe: How to stop updating a PictureBox? Pin
Matthew Butler21-Jun-08 3:14
Matthew Butler21-Jun-08 3:14 
GeneralRe: How to stop updating a PictureBox? Pin
MichaelCoder21-Jun-08 4:05
MichaelCoder21-Jun-08 4:05 
GeneralRe: How to stop updating a PictureBox? Pin
MichaelCoder21-Jun-08 5:28
MichaelCoder21-Jun-08 5:28 
AnswerRe: How to stop updating a PictureBox? Pin
Christian Graus21-Jun-08 12:39
protectorChristian Graus21-Jun-08 12:39 
GeneralCustom Combobox Pin
Brady Kelly20-Jun-08 5:30
Brady Kelly20-Jun-08 5:30 
GeneralRe: Custom Combobox Pin
Jaime Olivares20-Jun-08 12:17
Jaime Olivares20-Jun-08 12:17 
GeneralRe: Custom Combobox Pin
Thomas Stockwell23-Jun-08 15:28
professionalThomas Stockwell23-Jun-08 15:28 
QuestionConvert docx to PDF Pin
dhananjayamurthy20-Jun-08 0:30
dhananjayamurthy20-Jun-08 0:30 
AnswerRe: Convert docx to PDF Pin
Ashfield20-Jun-08 1:18
Ashfield20-Jun-08 1:18 
GeneralRe: Convert docx to PDF Pin
dhananjayamurthy20-Jun-08 3:34
dhananjayamurthy20-Jun-08 3:34 
GeneralRe: Convert docx to PDF Pin
Ashfield20-Jun-08 8:40
Ashfield20-Jun-08 8:40 
GeneralEditable Combobox Pin
Brady Kelly19-Jun-08 23:25
Brady Kelly19-Jun-08 23:25 
GeneralRe: Editable Combobox Pin
led mike20-Jun-08 7:03
led mike20-Jun-08 7:03 

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.