473,402 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Editing Multiple DataGridViews


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(SetInvalidC olumnNumber)
.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

Apr 20 '06 #1
2 1691
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/micro...7b8aa55ed5fd23

Ken
-----------------------

"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(SetInvalidC olumnNumber)
.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

Apr 20 '06 #2

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:
']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

Apr 21 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Steve | last post by:
Hi all Ok then I have searched through the back postings for a while now on google and read some interesting stuff on how to model a typical client / order db however.... My problem is that I...
2
by: martin1 | last post by:
all, is it possible to have more than one DataGridView within one Form? I try to bind dataset to different DatagridViews. Thanks
0
by: Susan Mackay | last post by:
I have an application that works well, with two DataGridViews connected with the necessary BindingSources, DataTables etc to have one DataGridView act as the parent and the other as the child in...
3
by: TomH | last post by:
I am using VB within VS 2005. How can I have multiple datagridviews on the same form pulling from the same table? e.g. I want to see all clients from New York in one view and all clients from LA in...
0
by: Bruce HS | last post by:
I use DataGridViews for the detail part of lots of Master/Detail entry forms. This time I need the user to see a dozen fields all at once for each detail record, and the best way to do this would...
7
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is...
0
by: Andrew Meador - ASCPA, MCSE, MCP+I, Network+, A+ | last post by:
I have a DataGridView control that is being populated by a database manually, not by being data bound). However, I need to run an algorithm based on a few columns of data for every row in the grid,...
10
by: =?Utf-8?B?UGV0ZXI=?= | last post by:
I'm using this coding to get 2 resultsets thru datareader and then load them into 2 datatables and bind the datatables to datagridviews. But sdrGrid.NextResult() is returning false for some...
6
by: Gun Slinger | last post by:
Hi guys, I have a quick question which i have pondered for a little while. I'm not sure if its even a good idea (so maybe advice on whether or not to do it would be helpful as well). I want to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.