Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » C# Question: How do I declare a body?
Closed Thread
Old 08-03-2009, 09:38 PM   #1 (permalink)
 
Newb Techie

Join Date: Jul 2009

Posts: 16

Crocodyle is on a distinguished road

Default C# Question: How do I declare a body?

Well I recently began with Visual C# and thought "Wow, this is pretty interesting."
So then I started googling and learned that "Close()" closes the window and MessageBox.Show("Message of Pop up", "Title of Pop up"); ACTUALLY DOES WHATEVER YOU JUST READ.

So yeah, I'm pretty excited about this.

Three things that I can't fix though I've googled it alot are these errors:
Quote:
Error 1:'UserInterface.Form1.button3_Click(object, System.EventArgs)' must declare a body because it is not marked abstract, extern, or partial
In order of the columns the info is "Form1.cs" - Line 45 - Column 22
Quote:
Error 2:Program 'C:UsersAdministratorDocumentsVisual Studio 2008ProjectsUserInterfaceUserInterfaceobjDebugUser Interface.exe' has more than one entry point defined: 'UserInterface.Program.Main()'. Compile with /main to specify the type that contains the entry point.
In order of the columns the info is "Program.cs" - Line 14 - Column 21
Quote:
Error 3:Program 'C:UsersCody SantosDocumentsVisual Studio 2008ProjectsUserInterfaceUserInterfaceobjDebugUser Interface.exe' has more than one entry point defined: 'UserInterface.Form1.ProcessStart.Main(string[])'. Compile with /main to specify the type that contains the entry point.
In order of the columns the info is "Form1.cs" - Line 48 - Column 25

And just for the sake of helping you guys out, below is the actual coding of my project.
Quote:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace UserInterface
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button2_Click(object sender, EventArgs e)
{
MessageBox.Show("Thank you.", "Ok");
Close();
}

private void button1_Click(object sender, EventArgs e)
{
Close();
}

private void label1_Click(object sender, EventArgs e)
{

}

private void checkedListBox1_SelectedIndexChanged(object sender, EventArgs e)
{

}

private void button3_Click(object sender, EventArgs e);
class ProcessStart
{
static void Main(string[] args)
{
Process notePad = new Process();

notePad.StartInfo.FileName = "notepad.exe";
notePad.StartInfo.Arguments = "ProcessStart.cs";

notePad.Start();
}
}
}
}
As you guys can see, I want to try launching different applications through this little application/program that I am trying to do.
All tips will be greatly appreciated.
Crocodyle is offline  
Old 08-04-2009, 08:25 AM   #2 (permalink)
 

Join Date: Jul 2005

Location: England

Posts: 2,159

kmote has a spectacular aura aboutkmote has a spectacular aura about

Default Re: C# Question: How do I declare a body?

In future, please put your code in [ code] tags not [ quote] tags otherwise it is difficult to read.
Error 1 says that you have not implemented the button3_Click method. Change
Code:
private void button3_Click(object sender, EventArgs e);
to
Code:
private void button3_Click(object sender, EventArgs e){}
Error 2 and 3 are because you have two main methods and the compiler needs to know which one you want to use as the entry point to the application.
The other main method is probably in the other part of your partial class Form1 and if you want it to start in the main that you have written then there is probably an option in your IDE to prevent that method being generated.
__________________
MSI P43 Neo|Enermax Pro82+ 425W|E5200|silent 8500GT|250GB Samsung spinpoint F1|Samsung SATA DVD RW|4GB Corsair|Antec SOLO|openSUSE11


There are in order of increasing severity: lies, darn lies, statistics, and computer benchmarks. - diskinfo man page
kmote is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Thermal Paste Question Higach Overclocking, Case Mod, Tweaking PC Performance 8 01-05-2008 12:48 AM
Rivatuner Question Drewser Overclocking, Case Mod, Tweaking PC Performance 2 11-28-2007 03:40 PM
New computer, tell me what you think! and one little question too rgoldberg1 Building, Buying, or Upgrading High Performance PC Systems 3 11-12-2007 10:19 PM
Power Supply Question + Overclocking Question Grievearz Building, Buying, or Upgrading High Performance PC Systems 21 09-12-2007 12:59 AM
question about my processor socket siddanth3 Building, Buying, or Upgrading High Performance PC Systems 10 04-27-2007 01:14 AM