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

Can we have code for GetPrecipitationPeriod?
Line 6 will only recieve line 5, not line 4.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.