Hi ,
Im switching from vb to c# and have syntax errors in this piece of code, which I couldnt figure out what. Any help pls? thanks
Code:namespace arraystringcheck { public partial class Form1 : Form { public Form1() { InitializeComponent(); } string grades; int mark; private void button1_Click(object sender, EventArgs e) { string[] grade ={ "Pass", "Merit", "Fail" }; foreach (Control c in this.controls) { if ((typeof (c is TextBox )) && (textbox.Text != null) { if (string m in grade) { switch (grades) { case "Merit": mark += 10; case "Pass": mark += 5; case "Fail": mark = mark; default: MessageBox.show ("grade is Invalid"); } } }label1.Text= mark.ToString; } } }





Reply With Quote