老师,你好!
在窗口上有一组合框和一文本框,我想组合框选定后对文本框自动赋值
组合框的Enter事件代码
Dim xt0 As String=e.Form.Controls("ComboBox5").text
Dim cmd As New SQLCommand
Dim dt As DataTable
Dim cmb As WinForm.ComboBox
cmd.C
cmd.CommandText = "S elect * FROM {zd_项目类别} where 项目类='"& xt0 &"'"
dt = cmd.ExecuteReader()
cmb = e.Form.Controls("ComboBox1")
cmb.ComboList= dt.GetComboListString("装置类","","代码")
组合框的SelectedIndexChanged事件代码(按帮助例子写的)
Dim cm As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim dt As DataRow = cm.SelectedItem
If dt IsNot Nothing Then
e.Form.Controls("TextBox4").text = dt("代码")
End If
出现以下错误信息:
.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2019.7.21.1
错误所在事件:窗口,新建项目,ComboBox1,SelectedIndexChanged
详细错误信息:
无法将类型为“System.String”的对象强制转换为类型“Foxtable.DataRow”。
请老师帮忙解决一下,谢谢!