Use a Drop-down list box and set focus in the DataGrid
Source: Internet
Author: User
datagrid| Dropdown | dropdown list simple use Drop-down list box in DataGrid
Author: Tushar Ameta
Translation: Autumn Maple
Use the Drop-down list problem in the DataGrid. This article talks about how to use the ComboBox control in System.Windows.Forms.DataGrid. But the original text is not complete, cannot debug, here in order to say clearly, to the original text made some changes, the whole article mainly includes three aspects of the content.
1. Add a ComboBox column to the DataGrid;
2. Save the changes in the DataGrid to the corresponding grid;
3. Sets the focus of the grid in the DataGrid.
Here is the entire source code, some features to see the comments.
Focus simulation, set up the third row in the first column
GetFocus (2,0);
}
}
}
Here is the Test interface:
Summarize This is done using the DataGridTextBoxColumn.TextBox.Controls.Add method to add a ComboBox control to the column, and the data is saved with the Combobox.selectionchangecommitted event; set Focus is Implemented by the DataGridTextBoxColumn.TextBox.Focus method. It is also possible to add similar controls such as DateTimePicker in this way.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.