What I have in VB is below. But what it does is after a number of tests is inputted on Form1 and "Submit" is clicked it reads TextBox6.Text and then prompts an InputBox that allows you to input a score for each test you identified i.e. if you said 3 tests it will run three times then be calculated and output the GPA for the tests to the second form. It worked perfectly in VB but I cant get it to work in C#. Any help would be greatly appreciated.
Dim Prompt, Title As String
Dim A As Short
Total = 0
Prompt = "Enter Test Scores For " & TextBox1.Text
Grade = TextBox6.Text
If Grade > 0 Then ReDim Scores(Grade - 1)
For A = 0 To UBound(Scores)
Title = "Score " & (A + 1)
Scores(A) = InputBox(Prompt, Title)
Total = Total + Scores(A)
Next
Result = Format(Total / Grade, "00.0")
TestInfo.Label12.Text = Result
If TextBox2.Text = "Enter Course Title" Then
TestInfo.Show()
string Prompt = null;
string Title = null;
short A = 0;
int Total, Result;
float Grades;
int[] Scores = new int[A];
Prompt = "Enter Test Scores For " + TextBox1.Text;
Grades = TextBox6.Text;
if (Grades > 0)
Scores = new float[Grades];
for (A = 0; A <= Information.UBound(Scores); A++)
{
Title = "Score " + (A + 1);
Scores[A] = Interaction.InputBox(Prompt, Title);
Total = Total + Scores[A];
}
Result = (Total / Grades);

New Topic/Question
Reply



MultiQuote





|