0

Private Sub Command1_Click()
Select Case Me.Text1.Text
Case 1
MsgBox ("U Entered 1")
Case 2
MsgBox ("U entered 2")
Case 3
MsgBox ("u entered 3")
Case Default
MsgBox ("Default")
End Select
End Sub

When i enter 4 in textbox1, Msgbox is not displayed.....Default is a valid case or not in VB

3
Contributors
2
Replies
8
Views
9 Years
Discussion Span
Last Post by anup_1
1

Use "Case Else":

Select Case Me.Text1.Text
    Case 1
        MsgBox ("U Entered 1")
    Case 2
        MsgBox ("U entered 2")
    Case 3
        MsgBox ("u entered 3")
    Case Else
        MsgBox ("Default")
End Select
Votes + Comments
useful
0

you are wrong Ezzaral case else is not the same as case default:

Edited by anup_1: code tag

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.