以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  删除前判断行是否被其它表,引用。  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=82670)

--  作者:yancheng
--  发布时间:2016/3/22 16:15:00
--  删除前判断行是否被其它表,引用。
Dim nm() As String = {"采购进货","销售明细","入库明细"}
Dim nm1() As String = {"采购订单","销售订单","采购入库"}
For i As Integer = 0 To nm.Length-1
    Dim drs As List (of DataRow) = DataTables(nm(i)).Select(" 定额编码 = \'" & e.DataRow("定额编码") & "\' ")
    If drs.Count > 0 Then
        Dim result As DialogResult = MessageBox.Show("此材料已被:\'"& nm(i) &"\' 录入,是否删除对应采购进货明细后再删除本条材料?","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Question)
        If result = dialogresult.no Then
            e.Cancel = True
        Else
            e.Cancel = True
            Forms(nm1(i)).show
            \'Dim filter As String = "1=2"
            \'For Each dr As DataRow In drs
                \'filter &= " or 进货批次 = \'" & dr("进货批次") & "\'"
            \'Next
            \'Tables(nm1(i)).Filter = filter
        End If

    ElseIf drs.Count = 0 Then

        If MessageBox.Show("是否删除本条机具?","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Question) = DialogResult.yes Then
        Else
            e.Cancel = True
        End If
    End If
Next

问题是:
1、即使被引用,也要先弹两个:是否删除本条机具?的提示窗口。
2、被引用,Forms(nm1(i)).show不弹出。(并列窗口。主窗口类型)

--  作者:大红袍
--  发布时间:2016/3/22 16:22:00
--  

Dim nm() As String = {"采购进货","销售明细","入库明细"}
Dim nm1() As String = {"采购订单","销售订单","采购入库"}
Dim fdr As DataRow
For i As Integer = 0 To nm.Length-1
    fdr = DataTables(nm(i)).Find("定额编码 = \'" & e.DataRow("定额编码") & "\' ")
    If fdr IsNot Nothing Then
        Dim result As DialogResult = MessageBox.Show("此材料已被:\'"& nm(i) &"\' 录入,是否删除对应采购进货明细后再删除本条材料?","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Question)
        If result = dialogresult.no Then
            e.Cancel = True
        Else
            e.Cancel = True
            Forms(nm1(i)).show
        End If
        Exit For
    End If
Next
If fdr Is Nothing Then
    If MessageBox.Show("是否删除本条机具?","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Question) = DialogResult.yes Then
    Else
        e.Cancel = True
    End If
End If

 


--  作者:yancheng
--  发布时间:2016/3/22 16:31:00
--  
老师,这种要打开:并列窗口,的不弹开。是什么原因?
--  作者:大红袍
--  发布时间:2016/3/22 16:52:00
--  

是不是要切换表

 

Forms(nm1(i)).show

maintable = Tables("窗口所在的表")


--  作者:yancheng
--  发布时间:2016/3/22 17:12:00
--  
不是切换主表的事。我把窗口改成:模式窗口,就行了。但是我这个用的时候 ,一般是改成:并列窗口。不能一直是模式窗口。

图片点击可在新窗口打开查看此主题相关图片如下:111.jpg
图片点击可在新窗口打开查看

--  作者:大红袍
--  发布时间:2016/3/22 17:21:00
--  

你要切换到对应的表才能看到你的并列窗口

 

maintable = Tables("功能导航")


--  作者:yancheng
--  发布时间:2016/3/22 18:18:00
--  
完美解决。谢谢。