Foxtable(狐表)用户栏目专家坐堂 → [求助]BeforeAddDataRow代码问题


  共有1782人关注过本帖平板打印复制链接

主题:[求助]BeforeAddDataRow代码问题

帅哥哟,离线,有人找我吗?
cqlwsam
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:五尾狐 帖子:1014 积分:7535 威望:0 精华:0 注册:2010/4/12 12:23:00
[求助]BeforeAddDataRow代码问题  发帖心情 Post By:2018/11/12 17:55:00 [只看该作者]

如图:


图片点击可在新窗口打开查看此主题相关图片如下:360截图18720117446945.png
图片点击可在新窗口打开查看

运行后出现的问题:


图片点击可在新窗口打开查看此主题相关图片如下:360截图1872012010011699.png
图片点击可在新窗口打开查看



BeforeAddDataRow代码:


'''

Dim frm As WinForm.Form = Forms("行政区域库维护")

If frm.Opened = False Then

    frm.open()

End If


Dim txt As String = frm.Controls("TextBox6").text

Dim txt1 As String

If txt="" Then

    MessageBox.show("信息添加前需选择检索字段录入检索词确认库中无相同信息后进行,以避免重复!","提示",MessageBoxButtons.OK,MessageBoxIcon.Question)

    e.Cancel = True

Else

    MessageBox.show("txt:" & txt)

    For Each c As WinForm.Control In frm.Controls

        If Typeof c Is WinForm.RadioButton Then '判断控件是否是单选框

            Dim t As WinForm.RadioButton = c '使用特定类型的变量引用控件

            If t.checked Then

                txt1= t.Text

            End If

        End If

    Next

    MessageBox.show(txt1)


    Dim dr As DataRow = e.DataTable.Find("[" & txt1 & "] ='" & txt & "'")

    If dr Is Nothing Then '如果找到的话

       e.DataRow(txt1) =txt

    Else

        MessageBox.Show("表中有相同的行政信息,请重新选择检索字段录入检索词并确认无相同的内容后进行,以避免重复!","提示",MessageBoxButtons.OK,MessageBoxIcon.Question)

        e.cancel =True

    End If

End If


前后都能通过,拉黄的有问题。



 回到顶部