做时间的朋友😭
随便记记02

当打开组合框的下拉列表时发生。

1
2
3
4
5
6
private int comboxIndex = -1;
private void DropDown(object sender, EventArgs e)
{
// 获取第一次combobox中的值的索引
comboxIndex = cbValue.SelectedIndex;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

private void ComboBox_SelectionChanged(object sender, EventArgs e)
{
if(cbValue.Equals(1))
{
// 如果选中不符合条件的项目,恢复到默认
ErrorMessageBox.Show(msg);
cbValue.SelectedIndex = comboxIndex;
}
}

private readonly string[] _requestColumns =
{
ColumnNames.A, ColumnNames.B, ColumnNames.C, ColumnNames.D
};
var columnValueList = new List<string>();
var dataRow = Table.Rows[0];
foreach(var requestColumn in _requestColumns)
{
var columnValue = dataRow[requestColumn].ToString();
if (!string.IsNullOrEmpty(columnValue))
{
columnValueList.Add(columnValue);
}
}

foreach (var item in collection)
{
if (item == "A")
{ // 跳出循环
continue;
}
if (item == "B" )
{
// ToDo...
}
}
C# WPF
随便记记03
随便记记01
© 2022 Sk8erBoi
Powered by hexo | Theme is blank