The code is fine, There are many reasons for this error, such as a missing semi-colon, a missing assembly reference, and other things.
Not being able to see your code makes it impossible to provide more specific assistance.
To further solve your problem, I suggest you post your complete code.
Best regards,
Sam
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
None
0 Points
1 Post
Expected class, delegate, enum, interface, or struct
Feb 17, 2020 10:31 AM|yashwanth Prasad|LINK
Expected class, delegate, enum, interface, or struct,,, im getting this error while compiling below code.
protected void btnexcel_Click(object sender, EventArgs e) { grvtbl_UserMaster.AllowPaging = false;
All-Star
48510 Points
18071 Posts
Re: Expected class, delegate, enum, interface, or struct
Feb 17, 2020 10:48 AM|PatriceSc|LINK
Hi,
It seems correct but likely misplaced. This is inside your page class declaration ?
Edit: I found https://docs.microsoft.com/en-us/dotnet/csharp/misc/cs1518 but it might be in old compilers. Here it seems I rather have https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/cs0116 for the same situation (ie it tells what is wrong rather than what is expected here).
Contributor
3370 Points
1409 Posts
Re: Expected class, delegate, enum, interface, or struct
Feb 18, 2020 03:24 AM|samwu|LINK
Hi yashwanth,
The code is fine, There are many reasons for this error, such as a missing semi-colon, a missing assembly reference, and other things.
Not being able to see your code makes it impossible to provide more specific assistance.
To further solve your problem, I suggest you post your complete code.
Best regards,
Sam