Click here to Skip to main content
14,032,238 members
Rate this:
 
Please Sign up or sign in to vote.
Hello Guys nowadays am working on an attendance software and there is an issue that I am facing and I am not able to resolve it actually it not error
i want to calculate the time of every total hours cell value of Datagridview and shows in the message box

please see the screenshots for the better understanding of my question.
picture #1[^]
picture #2[^]
picture #3[^]

Please, Guys, Help me and tell me the solution how can I do this &
I will be really thankful to you.

What I have tried:

var grid1RowInd = -1;
            List dataGridView4HeaderDates = new List();
            
                var dg1Date = DateTime.Parse(dataGridView1.Rows[0].Cells[0].Value.ToString().Split(' ')[0]);
                var ind = dataGridView4HeaderDates.IndexOf(dg1Date.Date);
                var rInd = ind * 3;
                dataGridView5.Columns.Add("1", "Time");
                dataGridView5.Rows.Add();
                dataGridView5.Rows[grid1RowInd].Cells[0].Value = dataGridView4.Rows[0].Cells[rInd + 2].Value.ToString();
Posted
Updated 24-Mar-19 5:28am
v2
Comments
Maciej Los 24-Mar-19 6:03am
   
What's you issue?
OriginalGriff 24-Mar-19 6:07am
   
What have you tried?
Where are you stuck?
What help do you need?

We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
Richard MacCutchan 24-Mar-19 6:23am
   
It appears from the images that you already have values in your grid. What is the problem?

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

I never understand why folks want to muck with the grid; when adding calculations to the "data source items" seems so much simpler.

Like making a meatball sandwich without the meatball.

Anyway ...

c# - Calculation in DataGridView column - Stack Overflow[^]
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web05 | 2.8.190419.4 | Last Updated 24 Mar 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100