或者函数只看第一个值

Or function only looks at first value

Private Sub btnSubmit_Click(sender As Object, e As EventArgs) Handles btnSubmit.Click
    Dim difficulty As Integer 'Sets difficulty as integer
    If txtBack.Visible = True Or btnDisplay.Enabled = False Then 'if back of the flashcard is visible and if the start button has been clicked
        If Integer.TryParse(TxtDifficulty.Text, difficulty) AndAlso difficulty >= 1 AndAlso difficulty <= 3 Then 'If diffiuclty is between 1 and 3
            Dim front = txtFront.Text 'Defines front as variable which is equal to txtfront.text
            UpdateDifficultyLevel(front, difficulty) 'Calls subroutine
            MsgBox("Difficulty updated succesfully") 'outputs messagebox saying difficulty has been updated succesfully
        Else 'If user input is not an integer
            MsgBox("Please enter a number between 1 and 3") ' tells user that the difficulty must be a number
        End If
    Else 'If back of the flashcard is not visible and is start button has not been clicked
        MsgBox("Please display the flashcard") 'Tells user to display flashcard.
    End If
End Sub

此代码应该检查 txtback.visible = true 或 btndisplay.enabled = false 然后运行适当的代码。但是只有 txtback.visible 有效。我如何获得代码来检查 btndisplay.enabled = false?

您确定要使用 Or 吗?对该 if 语句的评论说: “如果条件 1 和条件 2 为真,则……”。在这种情况下,如果您希望两者都被检查和评估为真,只需执行

If txtBack.Visible = True And btnDisplay.Enabled = False Then