Hi Peeps,

Heres my problem I have a datagrid view that when a user uploads a csv file it populates the datagridview with the data. i use a query to work out the average of a column but when it works out the average it displays as a whole number regless if its a decimal eg if its 2.8 it will display as 2.

Is there anyway that I can format the cell using c# so it displays it as a decimal????

 private void periodToolStripMenuItem3_Click(object sender, EventArgs e) // Average Precip between two dates //Period
            WeatherDataInfoDataSet.WeatherInformationDataTable AveragePrecipitationbyPeriod = new WeatherDataInfoDataSet.WeatherInformationDataTable();
            AveragePrecipitationbyPeriod = weatherInformationTableAdapter.GetPrecipitationPeriod(DateTime.Parse(textBoxUserInput.Text));
            AveragePrecipitationbyPeriod = weatherInformationTableAdapter.GetPrecipitationPeriod(DateTime.Parse(textBoxUserInput1.Text));
            dataGridView1.DataSource = AveragePrecipitationbyPeriod;

thanks BRICK

4 Years
Discussion Span
Last Post by ddanbe
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.