hi
in my program, i need to get the values from the user via a textbox and then to add the value from the textbox into an array.
is this the right way to put the values inside the array?
CODE
foreach (double tempValue in txtGrade.Text)
{
gradesAL.Add(tempValue);
}
i've already created one array and one arraylist:
CODE
private double[] Grades = new double[] { };
private ArrayList gradesAL = new ArrayList();
is this the correct way?
so let's assume that I've added the values into the arraylist (which I doubt so). and i need to find the average of all the arrays. Is this the right way?
CODE
private void btnStats_Click(object sender, EventArgs e)
{
double sumAverage;
double sumScore;
sumScore = 0;
try
{
//to get the average value.
for (int i = 0; i < Grades.Length; i++)
{
sumScore =+ Grades[i];
sumAverage = Math.Truncate(sumScore / gradesAL.Count);
txtAverage.Text = sumAverage.ToString();
}
}
catch (Exception ex)
{
msgBox("Error: " + ex.Message);
}
thanks..need assistance urgently. sorry for the trouble as I'm very new to c#.
thanks and cheers
pooh