} expected errors in VS2005

S

SenthilVel

hi all

i am opening an exiting 1.1 developed ASPX project in VS2005.

i am getting more language editor problems :

for example:
for the below code :
/// <summary>

/// Next button on 'next/exit' line pressed

/// </summary>

private void nextButton_Click(object sender, System.EventArgs e) {

protected Getsid = this.omSSBaseDropDownList.SelectedValue.Trim();

}



i get errors like :

1.Error 1 } expected
O:\Misys\apps\ifc\webroot\mic\aspx\IfaceWizLabG.aspx.cs 256 71 O:\...\aspx\

2. Error 2 Invalid token '=' in class, struct, or interface member
declaration A.aspx.cs 257 25 O:\...\aspx\

3.Error 3 Invalid token '(' in class, struct, or interface member
declaration .Baspx.cs 257 76 O:\...\aspx\


Can any one let me know on how to over come these VS2005 errors?

Thanks

Senthil
 
C

Cowboy \(Gregory A. Beamer\)

Why are you using protected inside of an event handler? You cannot declare a
variable in that way inside of a routine.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside the box!
*************************************************
 
H

Hans Kesting

See inline
hi all

i am opening an exiting 1.1 developed ASPX project in VS2005.

i am getting more language editor problems :

for example:
for the below code :
/// <summary>

/// Next button on 'next/exit' line pressed

/// </summary>

private void nextButton_Click(object sender, System.EventArgs e) {

protected Getsid = this.omSSBaseDropDownList.SelectedValue.Trim();

A "type" is missing here (between "protected" and "Getsid"). I think it
should be:
string Getsid = ....
or even (if "Getsid" is already declared elsewhere):
Getsid = ....
 
S

SenthilVel

Hi

Thanks for the reply ...

See i have this question now :

The same file i used for this web application using vs2003 : CLR 1.1.

now when i used VS2005 and CLR 2.0 , i get these errors when i have codes
like below:

private void DupFaccodeDelete_Click( object sender, System.EventArgs e ) {

protected DeleteCacFacEventReq delReq = new DeleteCacFacEventReq();



Error 1 } expected Sample.aspx.cs 253

Is this way for declaring a protected member under a event function not
allowed in C#2.0 ?

IF so , do i need to to change the code which has these usage of protected
??

Please let me know on this ..

Thanks

Senthil
 
H

Hans Kesting

See also the reply by "Cowboy".

I'm not sure it's possible to declare a variable that is local to a
method as "protected". Why do you think you need that functionality
here?

either leave out the "protected" to make it a variable, local to the
method
or move the declaration up to class-level, where it makes sense to
define a protected variable.

Hans Kesting
 
S

SenthilVel

hi Hans

So u mean to say that in 2003 and CLR 1.1 , protected is supported and in
vs2005 and CLR 2.0 this way of declaring protected is not allowed ...

Is that true ?

Thanks
Senthil
 
H

Hans Kesting

hi Hans
So u mean to say that in 2003 and CLR 1.1 , protected is supported and in
vs2005 and CLR 2.0 this way of declaring protected is not allowed ...

Is that true ?

Thanks
Senthil

My *guess* is that the behaviour of VS2003 was wrong and has been
corrected in VS2005.

What are you trying to do? Why do you need "protected" here?

Hans Kesting
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top