Visual Basic消失文本框?

时间:2013-11-08 15:34:32

标签: vb.net textbox

我已经在网上寻找答案,并且无法自己复制错误,并且文本框看起来是透明的,无法点击;但是,如果您将“Text =”属性设置为包含消息,则文本框似乎正常。

我多次查看属性和代码,似乎没有任何关闭。没有要求文本框是透明的,我看到的任何内容都不会阻止它接受用户输入。

......“破碎”的代码是:

Public Class GuessingGame

    Const MIN As Integer = 1
    Const MAX As Integer = 50

    Private Sub btnCheckGuess_Click(sender As System.Object, e As System.EventArgs) Handles btnCheckGuess.Click
        Randomize()
        Static secretNumber As Integer = Int((MAX - MIN + 1) * Rnd() + MIN)
        Static Count = 0
        Dim guess As Integer

        Count = Count + 1
        guess = Val(Me.txtPlayerGuess.Text)
        If guess < MIN Or guess > MAX Then              'invalid guess
            MessageBox.Show("Guess out of range")
        ElseIf guess = secretNumber Then
            Me.lblMessage.Text = "You guessed it!"      'correct
            MessageBox.Show(Count)
        Else
            Call GiveHint(secretNumber, guess)
        End If
    End Sub

    Private Sub txtPlayerGuess_TextChanged(sender As System.Object, e As System.EventArgs)
        'Clear the current answer when the user begins to type a new value
        Me.lblMessage.Text = Nothing
    End Sub

    Private Sub GiveHint(firstNum As Integer, ByVal secondNum As Integer)
        If firstNum > secondNum Then
            MessageBox.Show("Too low.")
        Else
            MessageBox.Show("Too high.")
            End If
        End Sub
    End Class

任何人都有任何关于造成这种情况以及如何解决问题的想法?

0 个答案:

没有答案