John Nay
John Nay

Reputation: 13

Public Form1 The Modifier 'public' is not valid for this item need some advice

Hey What Am I doing wrong here Ill give you my code I need some advice..

My problem is "Public Form1 The Modifier 'public' is not valid for this item"

I would post my code but its to long because this site tells me that the body is limited to 30,000 characters so mine was 66,517 characters so I will just post a simple line of code mabe you can help me out with this I have no other way to give you all my code its to long there is a pastebin link to my code below

public form1()

{

    // this gives me a error when I compile it tells me this 
       The Modifier 'public' is not valid for this item

}

void splashstart()

{

    // this also gives me the issue as the same as the other one 

}

here is my errors from the console

{
   
Severity    Code    Description Project File    Line    Suppression 
State
Error   CS0106  The modifier 'public' is not valid for this item    
EMUVoodoo   C:\Users\man\Desktop\EMUVoodoo\embed a exe inside of the 
form\WindowsApplication1\emuvoodoo.cs   296 Active
Error   CS1001  Identifier expected EMUVoodoo   
C:\Users\man\Desktop\EMUVoodoo\embed a exe inside of the 
form\WindowsApplication1\emuvoodoo.cs   296 Active
Error   CS0106  The modifier 'public' is not valid for this item    
EMUVoodoo   C:\Users\man\Desktop\EMUVoodoo\embed a exe inside of the 
form\WindowsApplication1\emuvoodoo.cs   329 Active
Error   CS0161  '()': not all code paths return a value EMUVoodoo   
C:\Users\man\Desktop\EMUVoodoo\embed a exe inside of the 
form\WindowsApplication1\emuvoodoo.cs   296 Active

}

I thought that I would at least paste my code here at pastebin site so you all can read it to help me out further I know no other way to give you my code your site has a limit to how many code characters you can paste mine was 66,517 so yeah please help me out on this thanks.... here is the code paste at pastebin

My code to take a look at.

Upvotes: 1

Views: 1089

Answers (1)

Nesaje
Nesaje

Reputation: 595

As said in comments, you have placed public constructor to the OpenExe method. That is just wrong construct and that is the reason why your code does not compile. Move that constructor out of the OpenExe, as well as 'SplashStart'. Note that you already have another public default constructor, delete that one first. You might also want to call that constructor from the other one, as this one is showing your splashscreen and doing some initalization.

public Form1(ApplicationControl appControl, MenuStrip, ...) :this()
{
    // your other initialization code
}

And another piece of advice, if you allow, do some serious refactoring here. A method (or constructor) should not have more then seven parameters. Consider to extract some objects, grouping similar elements, like ToolStripMenuItem, for example.

Also, creating a separate thread in the form constructor and putting constructor body to sleep might not be the best practice as well. Create your form, just don't show it. You can, for example, show splashscreen, initialize a timer. Once 5 seconds is over, hide splashscreen, show your main form. Also, t.Abort(); is not recommended as well. Good luck. Hope this helps you a bit.

Upvotes: 1

Related Questions