473,769 Members | 2,170 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 SpecialPricingI sValid() Then
With grdvMagSpecialP ricing
.ClearSelection ()
.CurrentCell=

grdvMagSpecialP ricing.CurrentR ow.Cells(SetInv alidColumnNumbe r)
.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 1707
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 SpecialPricingI sValid() Then
With grdvMagSpecialP ricing
.ClearSelection ()
.CurrentCell=

grdvMagSpecialP ricing.CurrentR ow.Cells(SetInv alidColumnNumbe r)
.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
2400
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 have a client who wants to have multiple contacts & multiple address for each client. (about 2,000 client) He also has about 10 standard access driven letters he sends out to them periodically - however he wants the ability to set up multiple...
2
983
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
1374
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 the standard way. Whenever the parent record changes, the data displayed in the child DataGridView changes appropriately. However the first record in the child DataGridView is always highlighted as the 'current record' and I would like to have...
3
4482
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 another view on the same form. I've set up a parameterized tableadapter and pass it the city. How can I load the two views in VB code when the form loads? Thanks, Tom
0
1563
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 be to show two or three lines of controls for each record (not just scroll off to the right). Can I get the DataGridView to allow multiple rows per record, or is there some other control I should use?
7
15658
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 there an equivalent property for the DataGridView? I have searched, but have not found one. I would like the user to be able to see all the columns of the table on one screen - thus eliminating the need to use the horizontal scroll bar to view...
0
1190
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, and then store a new value in the last column of the row in the data grid (the column name is ProposedDistrict). Could someone please tell me how to do this. I have little experience with DataGridViews, especially trying to change the value of a...
10
2090
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 reason. Is that possible the connection is closed? Dim strConn As String = "Server=localhost;Database=northwind;" + _ "Integrated Security=SSPI" Dim cnnNwind As SqlConnection = New SqlConnection(strConn) Try Dim strSql As String = "select * from...
6
4157
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 have my first datagridview to have a multi-select (which i have currently), but what i want to happen when multiple rows are selected is different. I have a sub datagridview which is using a relationship in a dataset which allows the two...
0
9579
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9416
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9981
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9850
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8862
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5436
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3948
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3551
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.