| View previous topic :: View next topic |
| Author |
Message |
Microsoft Grandmaster Cheater
Reputation: 0
Joined: 01 Dec 2007 Posts: 730 Location: O-('-'Q)
|
Posted: Thu Oct 30, 2008 7:18 pm Post subject: C# HELP |
|
|
I was following a tutorial to make an internet browser that came with the C# 2008 program. I noticed I had several errors all which related to this statement.
| Code: | private void homeToolStripMenuItem_Click(object sender, System.EventArgs e)
{
webBrowser1.GoHome();
} |
the only thing underlined in red is the void command.
Why is this?
_________________
|
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Thu Oct 30, 2008 8:13 pm Post subject: |
|
|
What's the code before?
_________________
|
|
| Back to top |
|
 |
FullyAwesome I post too much
Reputation: 0
Joined: 05 Apr 2007 Posts: 4438 Location: Land Down Under
|
Posted: Thu Oct 30, 2008 11:43 pm Post subject: |
|
|
did you close off the previous code with a } bracket?
_________________
|
|
| Back to top |
|
 |
Microsoft Grandmaster Cheater
Reputation: 0
Joined: 01 Dec 2007 Posts: 730 Location: O-('-'Q)
|
Posted: Fri Oct 31, 2008 1:18 pm Post subject: |
|
|
| fullyawesome wrote: | | did you close off the previous code with a } bracket? |
yes they are all closed off with brackets but, the only thing that says is an error is the void part of the code
_________________
|
|
| Back to top |
|
 |
Spawnfestis GO Moderator
Reputation: 0
Joined: 02 Nov 2007 Posts: 1746 Location: Pakistan
|
Posted: Fri Oct 31, 2008 3:15 pm Post subject: |
|
|
| Gatekeeper wrote: | | fullyawesome wrote: | | did you close off the previous code with a } bracket? |
yes they are all closed off with brackets but, the only thing that says is an error is the void part of the code |
I don't get why it couldn't be void, it isn't returning anything, so it should be okay.
Post your full source and errors (pastebin.com) for us to help you.
_________________
CLICK TO HAX MAPLESTORAY ^ !!!! |
|
| Back to top |
|
 |
yoyonerd Grandmaster Cheater
Reputation: 0
Joined: 26 Apr 2008 Posts: 699 Location: -->formerly yoyonerd<--
|
Posted: Fri Oct 31, 2008 3:35 pm Post subject: |
|
|
i agree with spawn, everything looks completely fine
post the source and errors, it'll make things much easier
we might be able to help with just the errors, but we can fix it for you if we have the source
_________________
|
|
| Back to top |
|
 |
sloppy Expert Cheater
Reputation: 0
Joined: 17 Aug 2008 Posts: 123
|
Posted: Sat Nov 01, 2008 1:11 am Post subject: |
|
|
My guess is, you have your method outside the main class or you don't have a class defined.
| Code: | class MyClass // This is a class.
{
// All of your code belongs inside.
private void homeToolStripMenuItem_Click(object sender, System.EventArgs e)
{
webBrowser1.GoHome();
}
}
// Not outside! |
|
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Sat Nov 01, 2008 2:55 am Post subject: |
|
|
Do you not need an entry point?
| Code: | public int main( String[] args ) {
} |
|
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Sat Nov 01, 2008 7:57 am Post subject: |
|
|
| noz3001 wrote: | Do you not need an entry point?
| Code: | public int main( String[] args ) {
} |
|
This is WinForms stuff. Typically the entry point is in the Program.cs file--that's the default, and I'm assuming he's left it there.
Edit:
Here's the default entry point:
| Code: |
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Main());
}
|
_________________
|
|
| Back to top |
|
 |
Microsoft Grandmaster Cheater
Reputation: 0
Joined: 01 Dec 2007 Posts: 730 Location: O-('-'Q)
|
Posted: Sat Nov 01, 2008 11:51 am Post subject: |
|
|
nevermind guys, thanks a ton fro the help. though. Turns out for some reason the we browser was deleted from the application.
works fine now, thanks a bunch, though.
_________________
|
|
| Back to top |
|
 |
|