I'm using C# .net 4.0 VS 2010.
I copied the following code here in Stackoverflow and confirmed all from the reference that this is suppose to work, but i am having syntax error on my call on the "Application.Run(new ShoutBox());" the error is "The type or namespace 'ShoutBox' could not be found."
The project was originally build as a console application. I just recently added a windows form named ShoutBox and is saved as ShoutBox.cs. I have transfer my code to the form so it does not display stuff in console rather on a textbox of the windows form i created.
What did i missed? And how can i make it work?
using System;
using System.Windows.Forms;
namespace ChatApp
{
class ConsoleApplication1
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
//this one works
Application.Run(new Form()); // or whatever
//this one does not work, error on second ShoutBox
Form ShoutBox = new Form();
Application.Run(new ShoutBox());
}
}
}
Just for reference, here is my final working code: This code creates a new Shoutbox form instead of a blanked form.
using System;
using System.Windows.Forms;
using ShoutBox; // Adding this
namespace ChatApp
{
class ConsoleApplication1
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Form ShoutBox1 = new ShoutBox.ShoutBox(); //Changing this
Application.Run(ShoutBox1); //Changing this
}
}
}
where my Shoutbox form are as follows:
using System
using System.Windows.Forms;
namespace ShoutBox
{
public partial class ShoutBox : Form
{
....