Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

how to trap event1 when event2 is firing first ? how to override event2 ? (VS2013 - winform)

$
0
0

In a winform application (VS2013) I have a datagridview control and a button. On the datagridview control I invoke the cellvalidating event and set e.cancel = true to prevent leaving a cell that was entered as empty (devoid of data). More specifically, if I enter valid data into a given cell on the datagridview - I leave the cell and then return to the cell and delete the entered value) -- if I do not enter anymore valid data into the cell but I try leaving the cell -- the cellvalidating event keeps bringing up my messagebox that I must enter something into this cell before leaving.  I want to override this behavior when I click on the button:

pseudo code

if (btn1.Clicked == true)
   dont e.cancel if given cell is empty
else
   e.cancel if given cell is empty

The cellvalidating even occurs before the btn1.clicked event fires.  How can I override this behavior?

 

Rich P


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>