窗口的afterload事件中:
Dim cmb As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim a As String = DataTables("客户").GetComboListString("公司名称")
If a > "" Then
cmb.SelectedIndex = 0
End If
一般情况下,默认赋值就是第一个。上例就是默认打开窗口的时候,下拉框就有一个值了
或者用这个,指定打开的时候,默认值就是某一个
Dim cmb As WinForm.ComboBox = e.Form.Controls("ComboBox1")
For i
As
Integer = 0
To cmb.Items.Count - 1
If cmb.Items(i) =
"上海"
Then
cmb.SelectedIndex =
i
End
If
Next
[此贴子已经被作者于2018/2/27 18:23:39编辑过]