以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 老师,您好: (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=59462) |
-- 作者:youngk -- 发布时间:2014/11/4 18:54:00 -- 老师,您好: 有一列,要求必须是七位整数,如果不足7位出现提示;另外,要求在该列中找出与给定7位数的后五位相匹配的数字 是否可以呢?代码怎么写好呢? |
-- 作者:有点甜 -- 发布时间:2014/11/4 19:05:00 -- 1、在DataColChanging写入代码 If e.DataCol.Name = "第一列" Then If e.NewValue <> Nothing Then If cstr(e.NewValue).Length <> 7 Then msgbox("必须是7位") End If End If End If
2、
Dim num As Integer = 1234567 |
-- 作者:youngk -- 发布时间:2014/11/4 19:33:00 -- Dim num As Integer = 1234567 是什么意思呢? |
-- 作者:有点甜 -- 发布时间:2014/11/4 19:36:00 -- 给定的7位数啊 |
-- 作者:youngk -- 发布时间:2014/11/10 12:05:00 -- With e.Form.Controls("NumericComboBox3") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & " cstr(车号) Like \'" & .Value & "\'" End If End With |
-- 作者:youngk -- 发布时间:2014/11/10 12:05:00 -- With e.Form.Controls("NumericComboBox3") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & " cstr(车号) Like \'" & .Value & "\'" End If End With 请问老师 这段代码怎么改呢?
|
-- 作者:有点甜 -- 发布时间:2014/11/10 14:05:00 -- With e.Form.Controls("NumericComboBox3")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & " Convert(车号,\'System.String\') Like \'%" & .Value & "%\'"
End If
End With
|
-- 作者:youngk -- 发布时间:2014/11/10 15:09:00 -- With e.Form.Controls("NumericComboBox1") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & " 车号 = \'" & .Value & "\'" End If End With With e.Form.Controls("NumericComboBox2") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & " 标重 = \'" & .Value & "\'" End If End With With e.Form.Controls("NumericComboBox3") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & " Convert(车号,\'System.String\') Like \'%" & .Value & "%\'" End If End With With e.Form.Controls("TextBox4") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & " 备注 like \'%" & .Value & "%\'" End If End With 老师,我这段代码有问题吗?不过用起来还是得行。请您专业的把关一下,呵呵
|
-- 作者:有点甜 -- 发布时间:2014/11/10 15:10:00 -- 可以的 |
-- 作者:youngk -- 发布时间:2014/11/10 15:12:00 -- 谢谢。 |