以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 请教问题 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=150648) |
-- 作者:BG小白 -- 发布时间:2020/6/3 18:28:00 -- 请教问题 If e.KeyCode = keys.Enter Then Dim title As WinForm.TextBox = e.Form.Controls("title") Dim s As String = title.Text Dim r As DataRow = DataTables("GB").AddNew() r("SPDM") = s.SubString(0,7) r("GG1DM") = s.SubString(7,2) r("GG2DM") = s.SubString(9,2) r("sl") = 1 r.save() e.Cancel = True title.SelectAll End If
|
-- 作者:y2287958 -- 发布时间:2020/6/3 21:01:00 -- 判断一下字符的长度再执行后续代码 |
-- 作者:BG小白 -- 发布时间:2020/6/4 0:17:00 -- If e.KeyCode = keys.Enter Then Dim title As WinForm.TextBox = e.Form.Controls("title") Dim s As String = title.Text Dim r As DataRow = DataTables("GB").AddNew If s.Length > 11 这里只能大于不能写<>不然就提示错误 MessageBox.Show("货号输入错误","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) r("SPDM") = s.SubString(0,7) If s.Length > 11 r("GG1DM") = s.SubString(7,2) If s.Length > 11 r("GG2DM") = s.SubString(9,2) r.save() e.Cancel = True title.SelectAll End If End If End If End If
|
-- 作者:有点蓝 -- 发布时间:2020/6/4 9:10:00 -- If e.KeyCode = keys.Enter Then Dim title As WinForm.TextBox = e.Form.Controls("title") Dim s As String = title.Text If s.Length <> 11 MessageBox.Show("货号输入错误","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) Return End If Dim r As DataRow = DataTables("GB").AddNew r("SPDM") = s.SubString(0,7) r("GG1DM") = s.SubString(7,2) r("GG2DM") = s.SubString(9,2) r.save() e.Cancel = True title.SelectAll End If |