首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >NumericUpDown错误消息

NumericUpDown错误消息
EN

Stack Overflow用户
提问于 2014-11-05 04:58:24
回答 1查看 84关注 0票数 0

我是Visual Basic的新手,我有一个问题希望能有一个简单的答案。我有两个NumericUpDown按钮,如果第二个按钮比第一个按钮大,我需要显示错误消息。(即“第二个NumericUpDown的值必须等于或高于第一个NumericUpDown的值”)。

我知道第二部分会是

代码语言:javascript
复制
MessageBox.Show("Error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

如何告诉Visual basic在发生上述情况时仅显示此错误消息?

EN

回答 1

Stack Overflow用户

发布于 2014-11-05 05:28:17

只需比较这两个值,如果第二个值小于第一个值,则显示您的消息。

代码语言:javascript
复制
If numericUpDown2.Value < numericUpDown1.Value Then
  MessageBox.Show("The value for the second number " & _
                  "must be equal to or higher than the value " & _
                  "of the first number", "Error", _
                  MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26744908

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档