

What I am trying to do is capture the string from the prompt and convert it to an integer so that mathematical functions can be performed based on the number input. I appreciate you pointing that out to me. I will go through and change my variables to lowercase for readability.

The form has a textBox in which the user inputs the number of tests, then upon clicking a button, an InputBox opens allowing the user to enter the number of scores which they input in the textBox. I am trying to do this so that the numbers entered into the prompt can be used for calculations to determine an average. I was trying to place the data from the Prompt into each element of the array, not the string itself. I am continuing to search the web, but everything says there is not a way to use an InputBox / Prompt object, but they all reference earlier versions of Visual Studio as well. Private void Form1_Load(System.Object sender, System.EventArgs e)įor those wondering, yes this is an assignment for my college course, and yes it is due tonight. Private void Form1_FormClosing(System.Object sender, e) Private void ExitToolStripMenuItem_Click(System.Object sender, System.EventArgs e)

Private void ResetToolStripMenuItem_Click(System.Object sender, System.EventArgs e) Private void ToolStripMenuItem2_Click(System.Object sender, System.EventArgs e) TxtClass4.Text = StreamToRead.ReadLine() TxtClass3.Text = StreamToRead.ReadLine() TxtClass2.Text = StreamToRead.ReadLine() TxtClass1.Text = StreamToRead.ReadLine() StreamToRead = new StreamReader("C:\\vb10sbs\\GPA\\grades.txt") Private void ToolStripMenuItem1_Click(System.Object sender, System.EventArgs e) TxtClass4.Text + "\n" + txtTest4.Text + "\n" + textBox4.Text) TxtClass3.Text + "\n" + txtTest3.Text + "\n" + textBox3.Text + "\n" + TxtClass2.Text + "\n" + txtTest2.Text + "\n" + textBox2.Text + "\n" + StreamToWrite.Write(txtClass1.Text + "\n" + txtTest1.Text + "\n" + textBox1.Text + "\n" + StreamToWrite = new StreamWriter("C:\\vb10sbs\\GPA\\grades.txt") Private void Button7_Click(System.Object sender, System.EventArgs e) Private void Button6_Click(System.Object sender, System.EventArgs e) ((Convert.ToInt32(txtTest1.Text)) + (Convert.ToInt32(txtTest2.Text)) + (Convert.ToInt32(txtTest3.Text)) (Convert.ToInt32(txtTest3.Text))) + (Convert.ToInt32(textBox4.Text) * (Convert.ToInt32(txtTest4.Text)))) (Convert.ToInt32(textBox2.Text) * (Convert.ToInt32(txtTest2.Text))) + (Convert.ToInt32(textBox3.Text) * TextBox5.Text = Convert.ToString(((Convert.ToInt32(textBox1.Text) * (Convert.ToInt32(txtTest1.Text))) + Private void Button5_Click(System.Object sender, System.EventArgs e) TextBox4.Text = Convert.ToString((Total4) / NumTest4) NumTest4 = Convert.ToInt16(txtTest4.Text) Private void Button4_Click(System.Object sender, System.EventArgs e) TextBox3.Text = Convert.ToString((Total3) / NumTest3) NumTest3 = Convert.ToInt16(txtTest3.Text) Private void Button3_Click(System.Object sender, System.EventArgs e) TextBox2.Text = Convert.ToString((Total2) / NumTest2) NumTest2 = Convert.ToInt16(txtTest2.Text) Private void Button2_Click(System.Object sender, System.EventArgs e) Private void Button1_Click(System.Object sender, System.EventArgs e) One last thing, I am using Visual Studio 2010 Ultimate.
VB NET 2010 INPUTBOX CODE
I believe I have the code 99% correct, except I cannot test it due to not being able to figure out the InputBox in C#. Also, there is another button (button 5) which calculates the overall average of all classes entered. To better understand the code, this program is supposed to read a class name, the number of tests in a class, then when the user clicks on the button, read the number of tests being input so it can calculate the average for that class. If someone can help me figure out the first one, I will be able to correct the other four errors. TextBox1.Text = Convert.ToString((Total1) / NumTest1) īelow this is the entire code, it has a total of 5 errors, all relating to what I am trying to accomplish of reading data from a InputBox / Prompt. Tests1 = Convert.ToInt16(Prompt.ToString) Prompt = "Please enter grade scores one at a time" NumTest1 = Convert.ToInt16(txtTest1.Text) private void Button1_Click(System.Object sender, System.EventArgs e) Here is the snippet I am concerned with fixing, but below I will post the entire code.
VB NET 2010 INPUTBOX HOW TO
I am working on a project of converting VB code to C# code and I am lost as to how to read data from a prompt in C#.
