我是Visual Basic的新手,我有一个问题希望能有一个简单的答案。我有两个NumericUpDown按钮,如果第二个按钮比第一个按钮大,我需要显示错误消息。(即“第二个NumericUpDown的值必须等于或高于第一个NumericUpDown的值”)。
我知道第二部分会是
MessageBox.Show("Error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)如何告诉Visual basic在发生上述情况时仅显示此错误消息?
发布于 2014-11-05 05:28:17
只需比较这两个值,如果第二个值小于第一个值,则显示您的消息。
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 Ifhttps://stackoverflow.com/questions/26744908
复制相似问题