我在窗口中用的是Tabcontrol 这个控件 并且在 SelectedIndexChanged 中设置以下代码
Dim tb As WinForm.TabControl = e.Form.Controls("TabControl1")
Dim pg As WinForm.TabPage = tb.SelectedPage
If pg.Name = 1 Then
For Each dl As DataRow In DataTables("零售表").DataRows
dl.delete()
Next
DataTables("零售表").AllowEdit = False
Tables("零售表").ExtendLastCol = True
DataTables("零售表").SysStyles("EmptyArea").BackColor = Color.White
e.Form.Controls("DateTimePicker1").Text() = Date.Today
Dim r As DataRow
r = DataTables("零售单号").AddNew()
r("日期") = Date.Today
r("代码") = "ls"
e.Form.Controls("TextBox4").Text = r("编号")
e.Form.Controls("TextBox4").ForeColor = Color.Gray
e.Form.Controls("TextBox4").ReadOnly = BooleanEnum.True
DataTables("零售单号").save()
End If
If pg.Name = 2 Then
For Each ds As DataRow In DataTables("批发表").DataRows
ds.delete()
Next
DataTables("批发表").AllowEdit = False
Tables("批发表").ExtendLastCol = True
DataTables("批发表").SysStyles("EmptyArea").BackColor = Color.White
e.Form.Controls("DateTimePicker2").Text() = Date.Today
Dim rs As DataRow
rs = DataTables("批发单号").AddNew()
rs("日期") = Date.Today
rs("代码") = "pf"
e.Form.Controls("TextBox9").Text = rs("编号")
e.Form.Controls("TextBox9").ForeColor = Color.Gray
e.Form.Controls("TextBox9").ReadOnly = BooleanEnum.True
DataTables("批发单号").save()
End If
发布后提示找不到datetimepicker2这个 什么问题? 上面的代码没有问题