Subscribe to Subscribers
Talk to Webmaster Tony John

Online Members

baskar
More...


Forums » .NET » .NET »

Datagridview chekbox click event


Posted Date: 20 Aug 2012      Posted By:: Yogesh Brahmankar     Member Level: Silver    Member Rank: 1811     Points: 2   Responses: 3



On datagridview check box checked I want to do addition of amounts and on unchecked need to do subtraction. I handled cell click and cell content click event but after simultaneous clicks its not working properly.

Thanks and Regards,
Yogesh Brahmankar




Responses

#684759    Author: jignesh      Member Level: Gold      Member Rank: 396     Date: 20/Aug/2012   Rating: 2 out of 52 out of 5     Points: 1

can you post your code here so that we can give you proper solution.


 
#684761    Author: Yogesh Brahmankar      Member Level: Silver      Member Rank: 1811     Date: 20/Aug/2012   Rating: 2 out of 52 out of 5     Points: 1

my code as given below and same for the cell content click event-


Private Sub dgv_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv.CellClick
Try
If Me.dgv.Rows(e.RowIndex).Cells("colSelect").Value = CheckState.Checked Then
Me.dgv.Rows(e.RowIndex).Cells("colSelect").Value = CheckState.Unchecked
decAmount = decAmount - Me.dgv.Rows(e.RowIndex).Cells("colBalance").Value
Else
Me.dgv.Rows(e.RowIndex).Cells("colSelect").Value = CheckState.Checked
decAmount = decAmount + Me.dgv.Rows(e.RowIndex).Cells("colBalance").Value
End If
txtSelectAmt.Text = decAmount
Catch ex As Exception
throw ex
End Try
End Sub


Thanks and Regards,
Yogesh Brahmankar



 
#684765    Author: RayalaHariKishore      Member Level: Gold      Member Rank: 52     Date: 20/Aug/2012   Rating: 2 out of 52 out of 5     Points: 3

hi,

put the debugger and checked it. where it is going wrong exactly. and one more is don't read this multiple times declare var and assign to it so it is very easy for you to debug it.

this.dgv.Rows(e.RowIndex).Cells("colSelect").Value and
this.dgv.Rows(e.RowIndex).Cells("colBalance").Value.

Rayala HariKishore

try..try..try...you achieved it.
http://rayalaharikishore.wordpress.com/






 
Post Reply
You must Sign In to post a response.

Next : How to Know The Line starting Point (x1,y1) and ending point(x2,y2)?
Previous : Call the connection string from App.config for Windows Application
Return to Discussion Forum
Post New Message
Category:

Related Messages



Follow us on Twitter: https://twitter.com/dotnetspider

Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
2005 - 2012 All Rights Reserved.
.NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
Articles, tutorials and all other content offered here is for educational purpose only.
We are not associated with Microsoft or its partners.