|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Editing Multiple DataGridViewsI have multiple datagridviews on one form. I am allowing editing in the
grid, and am performing error checking.
I am validating the data, if it isn't valid, I am cancelling any other events fired. My problem is, I am validating in grid A, if they click in Grid B, I am popping up a message box informing them of the error, but if they click ok on the message box, and then click in grid B again, it goes on. The following is a code snippet: If Not SpecialPricingIsValid() Then With grdvMagSpecialPricing .ClearSelection() .CurrentCell= grdvMagSpecialPricing.CurrentRow.Cells(SetInvalidColumnNumber) .Focus() End With e.Cancel = True Exit Sub End If I'm not real sure how to bring the focus back to the grid with the error. I'm setting the currentcell, and setting focus, I would thing that would do it. Any help would be appreciated. -- jpenn44 ------------------------------------------------------------------------ jpenn44's Profile: http://www.hightechtalks.com/m322 View this thread: http://www.hightechtalks.com/t365040 Hi,
Why do you have 2 grids bound to the same data on one form. The datagridview has a cellvalidating event that you get the old value in the cell as well as the new value. http://groups.google.com/group/microsoft.public.dotnet.languages.vb/browse_thread/thread/38b61e6e5c8e87d4/147b8aa55ed5fd23?q=datagridview+tucker&rnum=9#147b8aa55ed5fd23 Ken ----------------------- Show quoteHide quote "jpenn44" wrote: > > I have multiple datagridviews on one form. I am allowing editing in the > grid, and am performing error checking. > > I am validating the data, if it isn't valid, I am cancelling any other > events fired. My problem is, I am validating in grid A, if they click > in Grid B, I am popping up a message box informing them of the error, > but if they click ok on the message box, and then click in grid B > again, it goes on. The following is a code snippet: > > > If Not SpecialPricingIsValid() Then > With grdvMagSpecialPricing > .ClearSelection() > .CurrentCell= > > grdvMagSpecialPricing.CurrentRow.Cells(SetInvalidColumnNumber) > .Focus() > End With > e.Cancel = True > Exit Sub > End If > > I'm not real sure how to bring the focus back to the grid with the > error. I'm setting the currentcell, and setting focus, I would thing > that would do it. > > Any help would be appreciated. > > > -- > jpenn44 > ------------------------------------------------------------------------ > jpenn44's Profile: http://www.hightechtalks.com/m322 > View this thread: http://www.hightechtalks.com/t365040 > > I don't have two grids bound to the same data, they are each bound to a
unique dataset, although I don't see the relevance of that. I am using the cellvalidating event....the code is within that, to validate the data.... But I am trying to capture when the user enters invalid data, to set the focus back to the invalid cell, no matter where they click. I can do this if they click in the datagridview where they are editing the row. But whenever they click outside that grid, I can still display the error message, but cannot set the focus back to the edited cell. 'Ken Tucker [MVP Wrote: Show quoteHide quote > ']Hi, > > Why do you have 2 grids bound to the same data on one form. The > datagridview has a cellvalidating event that you get the old value in > the > cell as well as the new value. > > http://tinyurl.com/ofb88 > > Ken > ----------------------- > > "jpenn44" wrote: -- jpenn44 ------------------------------------------------------------------------ jpenn44's Profile: http://www.hightechtalks.com/m322 View this thread: http://www.hightechtalks.com/t365040
Multi-line comments
Communication between forms Legacy Connection Object - I need a new one Form1 can't getfocus again... Execute something stored in a variable IE Privacy - DNS Problem - ASP.NET security issues with an upgraded VB6 program textbox enter or GotFocus Are there any tools that can generate call graph for Visual Basic .NET source codes? 77 lines code need 30MB ram ? |
|||||||||||||||||||||||