2016-12-09 6 views
-1

Ich habe ungefähr 5 versteckte Textbox, und 1 Knopf, dass, wenn ich es anklicke, es den verborgenen Text 1 durch 1 zeigt, aber was ich tun möchte, ist, wenn ich den Knopf einmal nur 1 Textfeld anklicke und Dann erscheint eine Meldung mit der Meldung "Möchten Sie fortfahren?" JA oder NEIN? Wenn ich Ja drücke, erscheint das zweite Textfeld, aber wenn ich Nein drücke, sollte die Nachrichtenbox geschlossen werden.Schließen der Nachricht, wenn nein geklickt wird

Ich habe diesen Code auf dem Button:

Private Sub revealtxtbox_Click(ByVal senders As System.Object, ByVal e As System.EventArgs) Handles revealtxtbox.Click 

txtbox1.visible = True 
If MsgBox("Do you Want to Continue", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Sample System") = MsgBoxResult.Yes then 
txtbox2.visible = true 

Elseif MsgBoxResult.Yes then 
txtbox3.visible = true 

Elseif MsgBoxResult.Yes then 
txtbox4.visible = true 

Elseif MsgBoxResult.Yes then 
txtbox5.visible = true 

End if 

der Code oben etwas funktioniert, aber wenn ich drücke NO, die txtbox3 zeigt und die msgbox geschlossen, sollte es nicht txtbox3 zeigen, sollte es nur die msgbox schließen .

+0

Dies ist ein einfaches Problem und ein wenig Fehlersuche helfen ... Sie das Debuggen versucht haben? – Codexer

Antwort

-1

Versuchen Sie, etwas mehr wie folgt statt:

Private Sub revealtxtbox_Click(ByVal senders As System.Object, ByVal e As System.EventArgs) Handles revealtxtbox.Click 

    txtbox1.visible = True 

    If MsgBox("Do you Want to Continue", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Sample System") <> MsgBoxResult.Yes then 
    Exit Sub 
    End If 

    txtbox2.visible = true 

    If MsgBox("Do you Want to Continue", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Sample System") <> MsgBoxResult.Yes then 
    Exit Sub 
    End If 

    txtbox3.visible = true 

    If MsgBox("Do you Want to Continue", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Sample System") <> MsgBoxResult.Yes then 
    Exit Sub 
    End If 

    txtbox4.visible = true 

    If MsgBox("Do you Want to Continue", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Sample System") <> MsgBoxResult.Yes then 
    Exit Sub 
    End If 

    txtbox5.visible = true 

End if 
Verwandte Themen