[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Locking user into a DataGrid if column totals are incorrect.

Posted on 2004-10-11
7
Medium Priority
?
233 Views
Last Modified: 2010-04-24

I'm having an issue keeping the user from leaving a data grid if certain criteria isn't met.

I'm able to the checking on the validating event of the datagrid.

I'm having the problem if the user clicks on either a button or menu option on the parent form.
I'm not able to stop the event from executing even though I'm trapping and displaying my message.

0
Comment
Question by:tlatacki
  • 4
  • 2
7 Comments
 
LVL 16

Expert Comment

by:RobertRFreeman
ID: 12281758
You should use the dataset's columnChanging event.  You can check the proposedvalue, then set the columnerror to track changes in the dataset and display errors in the grid.
0
 
LVL 16

Expert Comment

by:RobertRFreeman
ID: 12281816
If you want to keep them on the grid if there are errors, you can disable the other controls in either event.
i.e. if there is an error, set the columnerror and disable the controls, else set the columnerror = "" and enable the controls.
0
 
LVL 4

Accepted Solution

by:
eozz_2000 earned 80 total points
ID: 12282200
   Private Sub DataGrid1_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles DataGrid1.Validating
        MsgBox("Validating")
        e.Cancel = True
        Me.DataGrid1.Select()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MsgBox("Hello")
    End Sub

I use the Validating event of dataGrid to cancel the events of other controls, with:

e.Cancel = True
me.DataGrid1.Select()
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:tlatacki
ID: 12286282
eozz - Works for events on the child. But events (Menu/Toolbar) are still ran.

Robert - I'm trying to see how to disable the Items on the Menu (I think I've found) - but, I haven't found the Toolbar items.

FYI - I inherited this project, so I'm also still trying to understand its functions and use.
0
 
LVL 16

Expert Comment

by:RobertRFreeman
ID: 12289750
The toolbar can be disabled by referencing the toolbar on the form.
Click on the toolbar and look at the properties window to get the name.

Then just use the following:
ToolbarName.Enabled = false
0
 

Author Comment

by:tlatacki
ID: 12290952

I just don't see it.

I have to use
Me.MdiParent.Menu.MenuItems(0).Enabled = False  
to access the MenuItems - But they don't change right away.

But i can't seem to locate the ToolBar

I haven't done much programming with Parent / Child Forms either.
0
 
LVL 16

Assisted Solution

by:RobertRFreeman
RobertRFreeman earned 720 total points
ID: 12291016
Ok, then that's a different story.  You'll just need to type the mdiParent as its class name.

So let's say your parent form with the toolbar is named MyMainForm.

Then you'd use:

ctype(me.mdiparent, MyMainForm).ToolBarName.Enabled = false
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month20 days, 4 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question