Vb.net 我无法让我的程序在vb的文本框中输入一个单词,用作我绞刑架的当前单词
每当我在文本框中输入一个单词并按确认时,就会出现一个错误Vb.net 我无法让我的程序在vb的文本框中输入一个单词,用作我绞刑架的当前单词,vb.net,Vb.net,每当我在文本框中输入一个单词并按确认时,就会出现一个错误 correctlettersneeded = currentword.Length 但我不知道为什么。请帮忙 Private Sub confirm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles confirm.Click twoplayertxt.Text = currentword correctlettersne
correctlettersneeded = currentword.Length
但我不知道为什么。请帮忙
Private Sub confirm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles confirm.Click
twoplayertxt.Text = currentword
correctlettersneeded = currentword.Length
lblletters.Text = Val(correctlettersneeded)
checkword()
confirm.Visible = False
twoplayertxt.Visible = False
play.Visible = True
End Sub
这是我确认这个词时的代码
Private Sub checkword()
If currentword.Length < 1.1 Then
line2.Visible = False
End If
If currentword.Length < 2.1 Then
line3.Visible = False
End If
If currentword.Length < 3.1 Then
line4.Visible = False
End If
If currentword.Length < 4.1 Then
line5.Visible = False
End If
If currentword.Length < 5.1 Then
line6.Visible = False
End If
If currentword.Length < 6.1 Then
line7.Visible = False
End If
If currentword.Length < 7.1 Then
line8.Visible = False
End If
If currentword.Length < 8.1 Then
line9.Visible = False
End If
If currentword.Length < 9.1 Then
line10.Visible = False
End If
If currentword.Length < 10.1 Then
line11.Visible = False
End If
If currentword.Length < 11.1 Then
line12.Visible = False
End If
If currentword.Length < 12.1 Then
line13.Visible = False
End If
If currentword.Length < 13.1 Then
line14.Visible = False
End If
If currentword.Length < 14.1 Then
line15.Visible = False
End If
correctletters = correctlettersneeded
End Sub
校验字代码
此错误来自:
未处理NullReferenceException 以及以下分标题:
对象引用未设置为对象的实例欢迎使用堆栈溢出!请花点时间仔细回顾一下:我们不是读心术的人!NullReferenceException未处理,并且对象引用未设置为对象的实例可能重复的行“TwoPlayerText.Text=currentword”不应该是另一行吗?应用程序崩溃时currentword的值是多少?似乎它没有被正确设置,currentword的值是Nothing,而不是字符串值,这将导致此错误。