|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Call control's event from a collectionthat loops through and checks for any ErrorProvider text. The sub returns all the ErrorProvider strings that were found for display in a msgbox to let the user know that there were data errors found. This works great, however, sometimes a user does not ever enter a certain control, therefore that control's validating event is never called, so my Error collecting sub will not return anything for this control. I need to be able to loop through all controls on a form and call each control's validating event. I need this code to be reusable for multiple forms. Any suggestions. This does not work: Public Function CallEventOfCtrl( Controls as controlcollection) as string for each c as control in Controls c.Validated 'or call c.validated next End function
Show quote
Hide quote
"Bryan" <bryanv***@gmail.com> wrote in message Warning... VB6 answers are all I have but... doesn't dotNet have a news:1144874320.802186.62810@g10g2000cwb.googlegroups.com... >I pass my form's collection of controls to a public sub in a module > that loops through and checks for any ErrorProvider text. The sub > returns all the ErrorProvider strings that were found for display in a > msgbox to let the user know that there were data errors found. This > works great, however, sometimes a user does not ever enter a certain > control, therefore that control's validating event is never called, so > my Error collecting sub will not return anything for this control. I > need to be able to loop through all controls on a form and call each > control's validating event. I need this code to be reusable for > multiple forms. Any suggestions. > > This does not work: > > Public Function CallEventOfCtrl( Controls as controlcollection) as > string > for each c as control in Controls > c.Validated > 'or > call c.validated > next > End function > ValidateControls method? Events aren't really something you should call directly. Especially for controls that have no code in that specific event. In VB6, ValidateControls raises the Validate event for any control that currently has focus. I'm sure dotNet has something similar... well... ran ValidateControls through the "one eyed wizard" and it spits out... Call VB6.ValidateControls(Me) ....so it's a start. -- Ken Halter - MS-MVP-VB (visiting from VB6 world) - http://www.vbsight.com Please keep all discussions in the groups.. ..net has support for the ValidateControls method, but it is only used
for projects that are being upgraded from from VB6. Each control in the collection has a validated event, but control events don't seem to be accessible from outside their parent form. ..net has support for the ValidateControls method, but it is only used
for projects that are being upgraded from from VB6. Each control in the collection has a validated event, but control events don't seem to be accessible from outside their parent form.
All the king's horses and all the king's men.......
How do I determine if a control has a specific property i need timer interval more than 1 Minute. Class Inheritance Connection to Access Db with a password? AutoScroll listbox as I type string value to new form instance? getting application version... Purpose of Keyword "Overloads"? listview usage |
|||||||||||||||||||||||