hustino siat

hustino siat

  • NA
  • 68
  • 7.6k

Windows Form error on code. Visual Studio

Nov 3 2021 6:13 AM

This is my Class. no error

This is my first windows Form. No error

namespace LabEx
{

    public partial class frmRegistration : Form
    {
        private string _FullName;
        private int _Age;
        private long _ContactNo;
        private long _StudentNo;
        

        public long StudentNumber(string studNum)
    {

        _StudentNo = long.Parse(studNum);

        return _StudentNo;
    }

    public long ContactNo(string Contact)
    {
        if (Regex.IsMatch(Contact, @"^[0-9]{10,11}$"))
        {
            _ContactNo = long.Parse(Contact);
        }

        return _ContactNo;
    }

    public string FullName(string LastName, string FirstName, string MiddleInitial)
    {
        if (Regex.IsMatch(LastName, @"^[a-zA-Z]+$") || Regex.IsMatch(FirstName, @"^[a-zA-Z]+$") || Regex.IsMatch(MiddleInitial, @"^[a-zA-Z]+$"))
        {
            _FullName = LastName + ", " + FirstName + ", " + MiddleInitial;
        }

        return _FullName;
    }

    public int Age(string age)
    {
        if (Regex.IsMatch(age, @"^[0-9]{1,3}$"))
        {
            _Age = Int32.Parse(age);
        }

        return _Age;
    }

        public frmRegistration()
        {
            InitializeComponent();

        }

        private void frmRegistration_Load(object sender, EventArgs e)
        {

            string[] ListOfProgram = new string[]
            {
                "BS Information Technology",
                "BS Computer Science",
                "BS Information Systems",
                "BS in Accountanct",
                "BS in Hospitality Management",
                "BS in Tourism Management"
            };
            for(int i= 0; i < 6; i++)
            {
                cbPrograms.Items.Add(ListOfProgram[i].ToString());
            }
        }

        private void btnRegister_Click(object sender, EventArgs e)
        {
           
         
        }
    }
    
}

 

My third Windows form.. have error

 


Answers (6)