谢谢大红袍,我在iP表的DataColChangedIf e.DataCol.Name = "IP地址" Then
Dim str As String = Nothing
For j As Integer = 1 To 2
For i As Integer = 1 To 255
If DataTables("IP表").find("ip地址 = '192.168." & format(j, "000") & "." & Format(i, "000") & "'") Is Nothing Then
str = "192.168." & j & "." & i
Exit For
End If
Next
If str > Nothing Then Exit For
Next
msgbox(str)
End If
另外,我设置Select Case e.DataCol.name
Case "IP地址" Dim dr As DataRow = DataTables("IP表").Find("ip地址 = '" & e.OldValue & "'") If dr Is Nothing Then dr = DataTables("IP表").AddNew() dr("IP地址") = e.DataRow("IP地址") dr("姓名") = e.DataRow("使用人") Else dr("IP地址") = e.DataRow("IP地址") End IfEnd Select
怎么有的有姓名有的没有姓名
我的目的是:IP表自动生成192.168.1.1-192.168.1.255 ,然后在自动生成192.168.2.1-192.168.2.255然后和设备一览表相匹配我的IP地址,IP地址相同的则自动填写姓名。怎么实现