//Code Written By S Barratt
i would like my button display to - out put all the values of the arrayList.
------------------------------------------------------------------------------------------
i would very much like some information about key pressing so when the use presses the key enter return ( char 13).
i did try - but my key press_ down just does not work.
-----------------------------------------------------------------------------------------------
finally i would like someone to show me how to format a number into dollars or pounds and how to round a decimal to two points
i know it goes string("00.00.00"" but where do i put String(Fomat type)?? - eg. at start of value i am using to store data input at the end when i am doing data output?
------------------------------------------------------------------------------------------------
finally i need some help with dates and the addition of dates
any help or refrencing to other material would be greatly apprechiated.
This is A program storing scores etc.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
namespace Exercise13
{
public partial class FrmCalculateAverageScore : Form
{
ArrayList StoreValueOfScores = new ArrayList();
int Numberofscores;
int TotalOfScore;
int i;
int ValueScore;
bool DTrueOrFalse;
public FrmCalculateAverageScore()
{
InitializeComponent();
}
private void BtnCalculate_Click(object sender, EventArgs e)
{
int AverageScore;
DTrueOrFalse = false;
try
{
ValueScore = int.Parse(TbValueOfScore.Text);
}
catch (FormatException)
{
MessageBox.Show("Enter a number into Score Below 101");
TbValueOfScore.Clear();
TbValueOfScore.Focus();
DTrueOrFalse = true;
}
catch (OverflowException)
{
MessageBox.Show("Enter a number into Score Below 101");
TbValueOfScore.Clear();
TbValueOfScore.Focus();
DTrueOrFalse = true;
}
if (ValueScore > 101)
{
DTrueOrFalse = true;
MessageBox.Show("Enter a number into Score Below 101");
TbValueOfScore.Clear();
TbValueOfScore.Focus();
}
if (ValueScore < 0)
{
DTrueOrFalse = true;
MessageBox.Show("Enter a number into score Above 0");
TbValueOfScore.Clear();
TbValueOfScore.Focus();
}
if (DTrueOrFalse == false)
{
Numberofscores = Numberofscores + 1;
LblNumberOfScores.Text = Numberofscores.ToString();
StoreValueOfScores.Add(ValueScore);
TbValueOfScore.Clear();
TbValueOfScore.Focus();
for (int i = 0; i < StoreValueOfScores.Count; i++)
{
TotalOfScore = TotalOfScore + ValueScore;
LblScoreTotal.Text = TotalOfScore.ToString();
AverageScore = TotalOfScore / Numberofscores;
LblAverageScore.Text = AverageScore.ToString();
}
}
}
private void BtnExit_Click(object sender, EventArgs e)
{
Close();
}
private void BtnClear_Click(object sender, EventArgs e)
{
for (i = 0; i < StoreValueOfScores.Count; i++)
{
StoreValueOfScores.Remove(ValueScore);
LblNumberOfScores.Text = 0.ToString();
LblAverageScore.Text = 0.ToString();
TbValueOfScore.Focus();
LblScoreTotal.Text = 0.ToString();
Numberofscores = 0;
TotalOfScore = 0;
ValueScore = 0;
}
}
private void BtnDisplay_Click(object sender, EventArgs e)
{
for (i = 0; i < StoreValueOfScores.Count; i++)
{
MessageBox.Show(StoreValueOfScores[i].ToString());
}
}
}
}
//Code Written By S Barratt