以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  请教自定义登录窗口代码问题  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=186507)

--  作者:13315253800
--  发布时间:2023/5/8 10:06:00
--  请教自定义登录窗口代码问题

蓝老师,我想借助狐友分享的销售开票系统,改成新建账套的功能,这一步实现了,但用自定义登录窗口登录时总提示错误:

.NET Framework 版本:4.0.30319.36543

Foxtable 版本:2022.7.3.1

错误所在事件:

详细错误信息:

This row has been removed from a table and does not have any data.  BeginEdit() will allow creation of new data in this row.

自定义登录窗口的“确定”按钮代码是:

Dim tx1 As WinForm.ComboBox = e.Form.Controls("ComboBox1")

Dim user As String = tx1.text

Dim sss As String = e.Form.Controls("ComboBox2").text \'sss项目文件名

 

Dim tx2 As WinForm.TextBox = e.Form.Controls("TextBox2")

Dim pows As String = tx2.text

Dim dl As WinForm.Button = e.Form.Controls("Button1")

Dim dt As DataTable = DataTables("用户表")

Dim dr As DataRow

If user = "" Then

    MessageBox.show("请输入用户名称!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error)

    Return

Else

    dr = dt.find("用户名称=\'" & user & "\'")

    If dr IsNot Nothing Then

        If pows = dr("密码") Then

            PopMessage("登陆成功", "提示", PopIconEnum.Infomation, 1)

            dr("登陆时间") = Date.Now

            dr("登陆账套") = sss \'sss项目文件名

            dr.Save()

            usna = user

            syscmd.project.open(ProjectFile, sss)\'打开项目,ProjectFile返回已经打开的项目文件名

            e.Form.close

            \'syscmd.project.Exit(True)

            Return

        Else

            MessageBox.show("密码错误", "提示")

            Return

        End If

    Else

        MessageBox.show("用户不存在!", "提示")

        Return


--  作者:有点蓝
--  发布时间:2023/5/8 10:08:00
--  
AfterOpenProject事件代码发一下
--  作者:13315253800
--  发布时间:2023/5/8 10:08:00
--  
抱歉,少复制了几行


 End If

End If

 

敬请蓝老师指导一下,谢谢!



--  作者:13315253800
--  发布时间:2023/5/8 10:12:00
--  

AfterOpenProject


Forms("主窗口2").open()

MainTable = Tables("用户表")

If OpenFileArgs.count > 0 Then

Else

Forms("登陆").Open()

If usna = "" Then

syscmd.project.Exit()

Return

End If

End If

Dim dr As DataRow = DataTables("用户表").find("用户名称=\'" & usna & "\'")

If dr IsNot Nothing Then

StatusBar.Message1 = "用户:" & usna & "   " & "当前账套:" & dr("登陆账套")

End If

StatusBar.Message2 = 登陆日期:" & Date.Today


--  作者:有点蓝
--  发布时间:2023/5/8 10:23:00
--  
确定按钮
syscmd.project.open(ProjectFile, sss)
改为
Vars("sss") = sss

AfterOpenProject事件

Forms("主窗口2").open()

MainTable = Tables("用户表")

If OpenFileArgs.count = 0 Then

    Forms("登陆").Open()

    If usna = "" Then

        syscmd.project.Exit()

    else

        syscmd.project.open(ProjectFile, Vars("sss"))

    End If

    Return

End If

……


--  作者:13315253800
--  发布时间:2023/5/8 11:10:00
--  
好了,谢谢蓝老师!