Help with calling a sub.


New member
Mar 3, 2005
Programming Experience
Well, I am pretty much a newb working on an assignment for my Vb class. I have a little problem I hope someone may be able to help me with. I have created a menu on my form called Country. Under this there are are menus called United States, Canada, Japan, and Mexico. When one of these items is checked it should display a picture box with the corresponding countries flag. I have written a Sub procedure to allow only one menu item to be checked at a time, like radio buttons. I am then calling that procedure under my United States, Canada, Japan and Mexico menus. Everything looks correct but I am getting an error, statement is not valid in a namespace. It is underlining; Private Sub displayFlag(ByVal country as String). Would someone look at this let me know what you think? I would really appreciate it.

 Private Sub displayFlag(ByVal country As String) 
'set everything to false 
unitedMenuItem.Checked = False
canadaMenuItem.Checked = False
japanMenuItem.Checked = False
mexicoMenuItem.Checked = False
unitedPicturebox.Visible = False
canadaPicturebox.Visible = False
japanPicturebox.Visible = False
mexicoPicturebox.Visible = False
'now figure out which country you want 
'check the correct menu item and display the flag 
Select Case country
Case "united"
unitedMenuItem.Checked = True
unitedPicturebox.Visible = True
Case "canada"
canadaMenuItem.Checked = True
canadaPicturebox.Visible = True
Case "japan"
japanMenuItem.Checked = True
japanPicturebox.Visible = True
Case "mexico"
mexicoMenuItem.Checked = True
mexicoPicturebox.Visible = True
End Select
End Sub

Here are the menu's

Private Sub unitedMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles unitedMenuItem.Click
' Show the United States Flag. 
End Sub
Private Sub canadaMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles canadaMenuItem.Click
' Show the Canada Flag. 
End Sub

Thanks in advance.
Top Bottom