用下面代码试一试
Dim xx As WinForm.ComboBox = e.Form.Controls("学校")
Dim xyfxmc As String
xyfxmc = xx.Value
Dim fxbh As WinForm.TextBox = e.Form.Controls("学校编号")
Dim dr As DataRow
dr = DataTables("分校").SQLFind("分校名称 = '" & xyfxmc & "'")
If dr Is Nothing Then
msgbox("没找到")
Else
fxbh.Text= dr("分校编号")
MessageBox.show(dr("分校编号"))
End If