1
Reply

Main does not contain a constructor that takes 0 arguments

Celine Ilano

Celine Ilano

May 27 2014 10:20 AM
1.5k
namespace Patient_Information_System
{
    public partial class Doctors : Form
    {
        

        public Doctors()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            Main f2 = new Main();
            f2.ShowDialog();
        }
    }
}

I get the error there. 
Here is my main code.

namespace Patient_Information_System
{
    public partial class Main : Form
    {
        
        public Main(string UserName)
        {           
            InitializeComponent();
            label11.Text = UserName;
            toolStripStatusLabel2.Text = UserName;
            timer1.Start();
            load_usertbl();
        }

I cant seem to fix it :/ Ive tried placing the username string outside the main part. 

Answers (1)