TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ajit N
NA
352
71.5k
how to get opening and closing balance using datagridview
Apr 14 2019 6:54 AM
Hello, i want to show the opening and closing balance in datagridview.
so, i tried below code on datagridview's sorted event.
private
void
dataGridView1_Sorted(
object
sender, EventArgs e)
{
try
{
for
(
int
i = 1; i < dataGridView1.Rows.Count - 1; i++)
{
if
(dataGridView1.Rows[i].Cells[4].Value.ToString() !=
"0"
)
{
dataGridView1.Rows[i].Cells[5].Value = Convert.ToInt32(dataGridView1.Rows[i-1].Cells[5].Value) - Convert.ToInt32(dataGridView1.Rows[i].Cells[4].Value);
}
else
{
dataGridView1.Rows[i].Cells[5].Value = Convert.ToInt32(dataGridView1.Rows[i - 1].Cells[5].Value) + Convert.ToInt32(dataGridView1.Rows[i].Cells[1].Value);
}
}
}
catch
(Exception ex)
{
}
}
it show's me this type of output in datagridview which i displayed in below image
But as per my requirement i want this type of output in datagridview
so help how can i do this ?
Reply
Answers (
1
)
Add button dynamically in first column of DataGridView
When Create Dll