Home > Net >  How many columns drop-down box output value is selected?
How many columns drop-down box output value is selected?

Time:09-15


Is the dynamic data from three columns (SQL) derived from the selected concrete data, according to the list of export string
This is the table above
 public void _f_setTable () 
{

Int row=5;//the number of rows, plus a row headings
Int col=6;//the number of columns
For (int c=0; C & lt; Col. C + +)
{
If (c % 2==0)
{
CKB=new DataGridViewCheckBoxColumn ();
CKB. Width=50;
The switch (c)
{
Case 0: CKB. Tag=1; break;
Case 2: CKB. Tag=3; break;
Case 4: CKB. Tag=4; break;
}
DGV_Select. Columns. The Add (CKB);
}
The else
{
The CMB=new DataGridViewComboBoxColumn ();
CMB. MaxDropDownItems=10;
CMB. DisplayStyle=DataGridViewComboBoxDisplayStyle. Nothing;
CMB. Items. The Clear ();
The switch (c)
{
Case 1: foreach CMB data in _1 (var). The Items. The Add (data); CMB. Tag=1; break;
Case 3: foreach CMB data in _2 (var). The Items. The Add (data); CMB. Tag=2; break;
Case 5: foreach CMB data in _3 (var). The Items. The Add (data); CMB. Tag=3; break;
}
DGV_Select. Columns. The Add (CMB);
}
}

CodePudding user response:

The most stupid way is traversal, to determine whether checked

CodePudding user response:

Directly through the contents of each column of the DataGrid, if type is the ComboBox, direct access to the current selected value of the ComboBox, create a collection, deposit the ComboBox value to the collection, so you've got a drop-down box selected value,
  •  Tags:  
  • C#
  • Related