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 AndAlso s.Length <> 12
MessageBox.Show("货号输入错误","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
Dim r As DataRow = DataTables("GB").AddNew
If s.Length = 11 Then
r("SPDM") = s.SubString(0,7)
r("GG1DM") = s.SubString(7,2)
r("GG2DM") = s.SubString(9,2)
r("MDDM") = User.Name
r.save()
Else
r("SPDM") = s.SubString(0,8)
r("GG1DM") = s.SubString(8,2)
r("GG2DM") = s.SubString(10,2)
r("MDDM") = User.Name
r.save()
End If
e.Cancel = True
title.SelectAll
End If