它不断给我“公共子()中的许多参数”。我究竟做错了什么? [英] It keeps giving me the "to many arguments in public sub ()" What am I doing wrong?
本文介绍了它不断给我“公共子()中的许多参数”。我究竟做错了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试
如果 txtWord1.Text = < span class =code-keyword> String .Empty 或 txtWord2.Text = String .Empty 然后
MessageBox.Show( 错误:输入单词)
ElseIf txtWord1.Text> txtWord2.Text 然后
lblMessage.Show( Word 1大于Word 2)
ElseIf txtWord1.Text< txtWord2.Text 然后
lblMessage.Show( Word 1小于Word 2)
Else
lblMessage.Show( 两个单词相等)
结束 如果
Catch ex As 异常
MessageBox.Show( 错误:输入单词)
结束 尝试
结束 Sub
解决方案
Quote:
lblMessage.Show(Word 1大于Word 2)
我怀疑你打算打电话给MessageBox.Show( ...)
那里,在其他两个地方你叫lblMessage.Show(...)
:
如果 txtWord1.Text = 字符串 .Empty < span class =code-keyword>或 txtWord2.Text = 字符串 .Empty 然后
MessageBox.Show( 错误:输入)
< span class =code-keyword> ElseIf txtWord1.Text> txtWord2.Text 然后
MessageBox.Show( Word 1大于Word 2)
ElseIf txtWord1.Text< txtWord2.Text 然后
MessageBox.Show( Word 1小于Word 2)
Else
MessageBox.Show( 两个单词相等)
结束 如果
编辑:
根据您的评论,您希望在输入两个单词时在标签中显示消息:
如果 txtWord1.Text = 字符串 .Empty 或 txtWord2.Text = 字符串 .Empty 然后
MessageBox.Show( 错误:输入单词)
ElseIf txtWord1.Text> txtWord2.Text 然后
lblMessage.Text = Word 1大于Word 2
ElseIf txtWord1.Text< txtWord2.Text 然后
lblMessage.Text = Word 1小于Word 2
Else
lblMessage.Text = 两个单词都相等
结束 如果跨度>
Try
If txtWord1.Text = String.Empty Or txtWord2.Text = String.Empty Then
MessageBox.Show("Error: Enter both the words")
ElseIf txtWord1.Text > txtWord2.Text Then
lblMessage.Show("Word 1 is bigger than Word 2")
ElseIf txtWord1.Text < txtWord2.Text Then
lblMessage.Show("Word 1 is smaller than Word 2")
Else
lblMessage.Show("Both words are equal")
End If
Catch ex As Exception
MessageBox.Show("Error: Enter both the words")
End Try
End Sub
解决方案
Quote:
lblMessage.Show("Word 1 is bigger than Word 2")
I suspect you meant to callMessageBox.Show(...)
there, and in the other two places you've calledlblMessage.Show(...)
:
If txtWord1.Text = String.Empty Or txtWord2.Text = String.Empty Then MessageBox.Show("Error: Enter both the words") ElseIf txtWord1.Text > txtWord2.Text Then MessageBox.Show("Word 1 is bigger than Word 2") ElseIf txtWord1.Text < txtWord2.Text Then MessageBox.Show("Word 1 is smaller than Word 2") Else MessageBox.Show("Both words are equal") End If
EDIT:
Based on your comments, you want to display the messages in the label when both words have been entered:
If txtWord1.Text = String.Empty Or txtWord2.Text = String.Empty Then MessageBox.Show("Error: Enter both the words") ElseIf txtWord1.Text > txtWord2.Text Then lblMessage.Text = "Word 1 is bigger than Word 2" ElseIf txtWord1.Text < txtWord2.Text Then lblMessage.Text = "Word 1 is smaller than Word 2" Else lblMessage.Text = "Both words are equal" End If
这篇关于它不断给我“公共子()中的许多参数”。我究竟做错了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文