PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
WinForm Question
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
WinForm Question
![]() |
WinForm Question |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi,
I am trying to validate a form with two tab pages by looping through each control on the form and setting focus to it. I am running into a problem, each time I loop to a control on the tab page not selected it does not fire the validating the event. I am confused why this is happening and was wondering if there is a way around this. I have tried to use ctl.TopLevelControl property to get the tabpage and then call the Show method. However, this does not work very well. Here is the code below I use: formControls is an array of Controls that I create in a method that retrieves all the controls including subcontrols on the form. foreach (Control ctl in formControls) { if (ctl.CausesValidation) { ctl.Focus(); if(!this.Validate()) { break; } } } Thanks |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Nevermind I figured it out.
<eric> wrote in message news:up5xGk33DHA.1052@TK2MSFTNGP12.phx.gbl... > Hi, > > I am trying to validate a form with two tab pages by looping through each > control on the form and setting focus to it. I am running into a problem, > each time I loop to a control on the tab page not selected it does not fire > the validating the event. I am confused why this is happening and was > wondering if there is a way around this. I have tried to use > ctl.TopLevelControl property to get the tabpage and then call the Show > method. However, this does not work very well. Here is the code below I > use: formControls is an array of Controls that I create in a method that > retrieves all the controls including subcontrols on the form. > > foreach (Control ctl in formControls) > { > if (ctl.CausesValidation) > { > ctl.Focus(); > if(!this.Validate()) > { > break; > } > } > } > > Thanks > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

