以文本方式查看主题

-  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=47087)

--  作者:xiaofengfeng
--  发布时间:2014/3/4 12:43:00
--  这个代码我哪写错了

Dim t As Boolean=False
If e.form.controls("TextBox1").text="" And e.Form.controls("TextBox2").text="" Then
    t=True
End If

If t Then
    messagebox.show("YOU空值")
Else
 Tables("员工资料").AddNew
  Dim i As String = DataTables("员工资料").Compute("max(工号)", "是否离职  = false")
 Dim idx As Integer
  If i > "" Then    \'若有最大值,即表数据不为空
     idx = CInt(i.Substring(2,3)) + 1   \'提取字符串i里的数字,并加1
  Else
      idx = 1   \'若表数据为空 就=1
   End If
   e.Form.Controls("TextBox1").text = "WX" & Format(idx,"000")
End If


--  作者:xiaofengfeng
--  发布时间:2014/3/4 12:48:00
--  

出的问题就是  我认为如果文本框中有空值的话  就出现对话框 不增加一行 等到 把文体框中的内容 填进以后 再增加


--  作者:lsy
--  发布时间:2014/3/4 13:00:00
--  
For i As Integer = 1 To 2
    If e.Form.Controls("TextBox" & i).Text = "" Then
        MessageBox.Show("所有录入框都不能为空")
        Return
    End If
Next
Tables("员工资料").AddNew()
Dim s As String = DataTables("员工资料").Compute("Max(工号)", "是否离职 = False")
Dim idx As Integer
If s > "" Then    \'若有最大值,即表数据不为空
    idx = CInt(s.Substring(2,3)) + 1   \'提取字符串i里的数字,并加1
Else
    idx = 1   \'若表数据为空 就=1
End If
e.Form.Controls("TextBox1").Text = "WX" & Format(idx,"000")