Click here to Skip to main content
15,918,193 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hello Experts,

I have windows Forms in which gridview cell double click open a new form with the clicked row values providing an option to update. Here I have everything seems working fine. But when I closed the new form which shows the clicked row details, it is loading again instead of closing the form.
Here is my code to open the new form. And also the code in New form
 Private Sub DataGridView1_CellMouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseDoubleClick, DataGridView1.CellMouseDoubleClick 
Dim dialog As New EditFeaturedItem(row)
     dialog.ShowDialog()
     dialog.Dispose()
End Sub

And the New EditFeatureItem Form has below code
VB
Friend Class EditFeaturedItem
  Private _seq As DataGridViewRow

  Private Sub New()
    ' This call is required by the Windows Form Designer.
    InitializeComponent()
    ' Add any initialization after the InitializeComponent() call.
  End Sub
  Public Sub New(ByVal seq As DataGridViewRow)
    Me.New()
    _seq = seq
    ShowDetails(seq)
  End Sub



Can anyone help me out in resolving the issue.? I wanted to close the form if user clicks on Cross button on the form.
Posted
Updated 4-May-15 3:45am
v4
Comments
Sergey Alexandrovich Kryukov 1-May-15 16:02pm    
What button? The [x] button in the top right corner of the non-client area, or your own button? Normally, it does work in one click. You did not show any code which would screw it up, but certainly you screwed it up somehow. Provide adequate information, if you need help. Better yes, start over, from a project build from the template. Does closing works? Keep it this way and re-test on all steps. As soon as this part of functionality breaks, you will know where. Don't work without some suitable Revision Control System.
—SA
sudevsu 1-May-15 16:14pm    
Yeah I am talking about [X] button on top right corner. I don't understand why is it not closing. I hit on close button it goes to Datagridview1_cellMousedoubleclick event. Second time if I click it just closes without entering into event. I don't know where went wrong. But yeah I will build and see.thank you
Sergey Alexandrovich Kryukov 1-May-15 16:45pm    
Stop screwing up things. Start from the brand-new project and make sure it closes. And then, as I advised.
—SA
sudevsu 4-May-15 12:05pm    
OMG. It was my mistake simple though.

1 solution

Did you turn off the application framework?
 
Share this answer
 
Comments
sudevsu 4-May-15 8:35am    
Nope

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900