以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  关闭窗口问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=88793)

--  作者:落叶孤影
--  发布时间:2016/8/9 16:42:00
--  关闭窗口问题

我在窗口的beforclose事件中写一这样一段代码:为什么单击弹出的对话框后总是把当前打开的窗口也给关了呢?请老师帮忙看下是哪里错了,谢谢!另外想问下,如何设置光标停留在窗口控件中的位置呢?比如:窗口中有Combobox1和Combobox2,我想让窗口打开时让光标停留在Combobox1上,该如何设置?

 

If DataTables("日报表").HasChanges Then
    Dim Result As DialogResult
    Result =  MessageBox.Show("数据已经修改,是否保存?", "提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
    If Result = DialogResult.Yes Then
        If e.Form.Controls("项目简称").value Is Nothing Then
            MessageBox.Show("项目简称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Else If e.Form.Controls("项目名称").value Is Nothing Then
            MessageBox.Show("项目名称也不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Else If e.Form.Controls("资金可用余额").value Is Nothing Then
            MessageBox.Show("亲,你们项目一分钱也没有吗!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Else
            DataTables("日报表").Save()
        End If
    Else If Result = DialogResult.NO Then
        DataTables("日报表").RejectChanges
    Else If Result = DialogResult.cancel Then
        e.cancel = True
    End If
End If

 


--  作者:大红袍
--  发布时间:2016/8/9 16:48:00
--  
If DataTables("日报表").HasChanges Then
    Dim Result As DialogResult
    Result =  MessageBox.Show("数据已经修改,是否保存?", "提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
    If Result = DialogResult.Yes Then
        e.cancel = True
        If e.Form.Controls("项目简称").value Is Nothing Then
            MessageBox.Show("项目简称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Else If e.Form.Controls("项目名称").value Is Nothing Then
            MessageBox.Show("项目名称也不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Else If e.Form.Controls("资金可用余额").value Is Nothing Then
            MessageBox.Show("亲,你们项目一分钱也没有吗!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Else
            e.cancel = False
            DataTables("日报表").Save()
        End If
    Else If Result = DialogResult.NO Then
        DataTables("日报表").RejectChanges
    Else If Result = DialogResult.cancel Then
        e.cancel = True
    End If
End If

--  作者:落叶孤影
--  发布时间:2016/8/9 17:37:00
--  
谢谢!还有,窗口光标停留位置怎么设置啊?
--  作者:大红袍
--  发布时间:2016/8/9 17:44:00
--  
e.Form.Controls("Combobox1").Select