HOW? Invoking the EVENTs of a CONTROL

L

Lee Gillie

Can one invoke an event of a control?

For example, I am MANUALLY switching tabs on a TabControl. The way I am
doing it suppresses the Enter, GotFocus, Leave, Validating, Validated,
LostFocus sequence of events. I wish to preserve at least the Validating
event. To do so, I need to be able to invoke this event for a TabPage as
I prepare to go to the next tab (or close the form).

Something like:
RaiseEvent MyTabPage.Validating( sender, cancelargs )
would be really nice, but OF COURSE it doesn't work.

- Lee
 
L

Lee Gillie

Ed -

Not sure if it matters, when it comes to the basic question, but here
goes...

My intention is to utilize the Tab Pages similar to a Panel, but Tab
Pages does some nice design time layout. To completely suppress the tab
pages that are not current, and prevent them from being user selected, I
take them out of the on-screen tab-control and move them into a hidden,
manually created tab-control. Keeping hidden tab pages in a hidden tab
control is necessary to allow the form to close correctly.

I boiled this snippet to the most essential parts of my manual switch.

Private Sub GoToTabPage( ByRef NewTabPage as TabPage )
Do While TabControl1.TabPages.Count > 0
' I would like to raise an event,
' TabControl1.TabPages(0).Validating here
' and I would suppress the following line if
' feedback says to Cancel (as well as going
' to the new tab of course)
HiddenTC.TabPages.Add(TabControl1.TabPages(0))
Loop
TabControl1.TabPages.Add( NewTabPage )
' I would like to raise a NewTabPage.Enter event here
End Sub

I think regardless of the approach above, the mechanics of how to invoke
any event on a particular type of control instance is a much more
generic question.

- Lee
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top