这段代码写在table表里面,计划在窗口打开的时候,并且页面是第一个就执行第一段代码,第二段就执行第二段代码,这个应该怎么改
If Forms("工厂无损录入主界面").Opened = True Then
If Forms("工厂无损录入主界面").Controls("GroupBox2").SelectedIndex = 0
'遍历检测方法
For Each c As Winform.Control In Forms("工厂无损录入主界面").Controls
If Typeof c Is WinForm.RadioButton Then
Dim t As WinForm.RadioButton = c
If t.Name.StartsWith("检测方法") And t.Checked Then
e.DataRow("适用类型") = t.Text
End If
End If
Next
ElseIf Forms("工厂无损录入主界面").Controls("GroupBox2").SelectedIndex = 1
For Each c As Winform.Control In Forms("工厂无损录入主界面").Controls
If Typeof c Is WinForm.RadioButton Then
Dim t As WinForm.RadioButton = c
If t.Name.StartsWith("单位") And t.Checked Then
e.DataRow("单位") = t.Text
End If
End If
Next
End If
End If