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?
uj5u.com熱心網友回復:
您確定要使用 Or 嗎?對該 if 陳述句的評論說:“如果條件 1 和條件 2 為真,則……”。在這種情況下,如果您希望兩者都被檢查和評估為 true 就做
If txtBack.Visible = True And btnDisplay.Enabled = False Then
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/366498.html
標籤:网络
