需求是:有三个cmb_t1、cmb_t2、cmb_t3控件,只有有值的控件才能输入数据到表中,空值的不输入,如何实现?
For Each r As Row In CurrentTable.Rows
For Each c As WinForm.Control In e.Form.Controls
If Typeof c Is WinForm.ComboBox Then '判断控件是否是文本框
Dim cb As WinForm.ComboBox = c
If cb.Name.StartsWith("cmb_") AndAlso cb.value IsNot Nothing Then
'For Each r As Row In CurrentTable.Rows
r("第一列") = e.Form.Controls("cmb_t1").Value
r("第二列") = e.Form.Controls("cmb_t2").Value
r("第三列") = e.Form.Controls("cmb_t3").Value
'Next
End If
End If
Next
Next
此主题相关图片如下:66655.png
![dvubb 图片点击可在新窗口打开查看](UploadFile/2018-11/201811191481169334.png)
[此贴子已经被作者于2018/11/19 14:08:14编辑过]