Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 222
  • 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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