以文本方式查看主题

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

--  作者:jjjeyes
--  发布时间:2016/8/10 10:59:00
--  [求助]如何设置输入内容的范围和替换输入内容
问1:在身高列输入范围为140-210范围的数值,在体重列输入35-150范围的数值。我的方法如下,请问能否有更好更简单的代码??
If e.Col.Name = "身高" Then
    If e.Text <140 Then
        MessageBox.Show("输入范围无效!")
        e.Cancel = True
    ElseIf e.Text >210 Then
        MessageBox.Show("输入范围无效!")
        e.Cancel = True
    End If
End If
If e.Col.Name = "体重" Then
    If e.Text <35 Then
        MessageBox.Show("输入范围无效!")
        e.Cancel = True
    ElseIf e.Text >150 Then
        MessageBox.Show("输入范围无效!")
        e.Cancel = True
    End If
End If

问2:在长跑列直接输入3.40的时候能否直接替换为3\'40,并同样做输入范围的限制?

--  作者:cbt
--  发布时间:2016/8/10 11:09:00
--  
If e.Col.Name = "身高" Then
    If e.Text <140 Or  e.Text >210 Then
        MessageBox.Show("输入范围无效!")
        e.Cancel = True
    End If
End If

--  作者:cbt
--  发布时间:2016/8/10 11:15:00
--  

\'  DrawCell  绘制事件,

 

If e.Col.Name = "cc" Then
    e.Text = e.Text.Replace(".","\'")
End If