• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 224
  • Last Modified:

Error selecting menu item

Greetings

I have a piece of code in which I am trying to process the various menu options (sometime back I had the correct coding ... but neglecting to backup can be costly!!!).

y code:

Select Case e.Item.Text.ToUpper
          Case "PUPIL"
            int z = 1;
          Case "STAFF"
            int z = 2;
        End Select;


Errors:

1.  "e".  (as in "Select Case e.Item.Text.ToUpper") is underlined and the erro message is:
Error      1      ;


WHAT HAVE I MISSED?
0
allanmark
Asked:
allanmark
  • 6
  • 6
  • 2
1 Solution
 
jeebukarthikeyanCommented:
hi ,

remove the semicolon( End Select;)

and then try

b u d d h a
0
 
jeebukarthikeyanCommented:
hi,

if u r looking for a vb syntax the

 Select e.Item.Text.ToUpper
            Case "PUPIL"
                Dim i As Int16 = 1
            Case "STAFF"
                Dim x As Int16 = 10
        End Select

b u d d h a
0
 
allanmarkAuthor Commented:
Tried that - same result!

e. and "PUPIL" and "PUPIL" are underlined in red with the Error, "; Expected" on the Select Case line (e.) and on int z = 1

Me = confused!!
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
allanmarkAuthor Commented:
I'm using c#. Excluding thedim statements is ther any other difference?
0
 
p_davisCommented:
isn't it
switch (Case e.Item.Text.ToUpper)
{
         Case "PUPIL":
            int z = 1;
          break;
          Case "STAFF":
            int z = 2;
          break;
}

for c#
0
 
allanmarkAuthor Commented:
Me = confused!

Tried the following:

 protected void mnuSchoolKeeper_Main_MenuItemClick(object sender, MenuEventArgs e)
    {        

        switch (Case e.Item.Text.ToUpper)              // LINE 21
        {
            Case "PUPIL":
            int z = 1;
          break;
            Case "STAFF":
            int z = 2;
          break;
        }


    }

Error      1      ) expected      D:\MyStuff - Allan\Training\School_Keeper\School_Keeper_Web\School_Keeper_Main.aspx.cs      21      22      D:\...\School_Keeper_Web\  ==>> Note: e and the ) are both underlined in blue
Error      2      ; expected      D:\MyStuff - Allan\Training\School_Keeper\School_Keeper_Web\School_Keeper_Main.aspx.cs      21      41      D:\...\School_Keeper_Web\

0
 
p_davisCommented:
take out case
0
 
p_davisCommented:
in the switch evaluation-- sorry about that.
protected void mnuSchoolKeeper_Main_MenuItemClick(object sender, MenuEventArgs e)
    {        

        switch (e.Item.Text.ToUpper)              // LINE 21
        {
            Case "PUPIL":
            int z = 1;
          break;
            Case "STAFF":
            int z = 2;
          break;
        }


    }
0
 
allanmarkAuthor Commented:
Thanks  .... much better. Now getting the following:

  switch (e.Item.Text.ToUpper)
        {                                                // LINE 22
            Case "PUPIL":                       // LINE 23
            int z = 1;
          break;
            Case "STAFF":
            int z = 2;
          break;
        }

Error      1      } expected      D:\MyStuff - Allan\Training\School_Keeper\School_Keeper_Web\School_Keeper_Main.aspx.cs      22      10      D:\...\School_Keeper_Web\

Error      2      ; expected      D:\MyStuff - Allan\Training\School_Keeper\School_Keeper_Web\School_Keeper_Main.aspx.cs      23      18      D:\...\School_Keeper_Web\
0
 
p_davisCommented:
ToUpper needs to be ToUpper()
0
 
allanmarkAuthor Commented:
Still gives the same errors:

    switch (e.Item.Text.ToUpper() )
        {
            Case "PUPIL":
            int z = 1;
          break;
            Case "STAFF":
            int z = 2;
          break;
        }
0
 
p_davisCommented:
case is actually lowercase -- is this the way it is in your program?
0
 
allanmarkAuthor Commented:
THANKYOU - I had it "Case".

Many thanks for your help!!!!
0
 
p_davisCommented:
glad you got it working.-- but why the grade of b?-- did you need further explanation?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

  • 6
  • 6
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now