Forums » .NET » .NET »

How to compare the gridview cells in datagridview control in windows app


Posted Date: 30 Jun 2010      Posted By:: sarayu     Member Level: Gold    Member Rank: 1357     Points: 1   Responses: 3



HI all,

Here I want to compare the cell values in the datagridview for duplicates and need to show a message...

i am using datagridview control in windows application...

Please help me....




Responses

#522644    Author: swathi      Member Level: Gold      Member Rank: 303     Date: 30/Jun/2010   Rating: 2 out of 52 out of 5     Points: 2

can u explain clearly...which values u want to compare with datagridview cell values...?

Regards
swathi


 
#522648    Author: sarayu      Member Level: Gold      Member Rank: 1357     Date: 30/Jun/2010   Rating: 2 out of 52 out of 5     Points: 2

Hi...

The scenario is i want to enter new value in the grid and i have some previous rows in the same grid and now i want to check for duplicates which i have entered newly with previous row values.


 
#522667    Author: swathi      Member Level: Gold      Member Rank: 303     Date: 30/Jun/2010   Rating: 2 out of 52 out of 5     Points: 2

check it once...here i have two cols in gridview id and purpose..
i am adding new values to gridview when add button is clicked..

Private Sub btn_Add_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Add.Click

chkmandatory() 'calling function to check mandatory fields
If mandatory <> 1 Then
clearvalues()
'getting entered values into local variables
rid = txt_RequisitionId.Text.Trim
purpose = txt_Purpose.Text.Trim
For row1 As Integer = 0 To dgv_view.Rows.Count - 1
'if entered requistionid and itemid is already added then exit sub
If rid = dgv_view.Item(1, row1).Value.ToString Then
msgbox( "Item is already added")
Exit Sub
End If
Next
'adds rows to datagridview
dgv_view.Rows.Add(True, rid, purpose)
End If
End Sub





 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Return to Discussion Forum
Start new thread

Subscribe to Subscribers
Awards & Gifts
Talk to Webmaster Tony John

Online Members

Priya jain
More...
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India