Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / December 2004

Tip: Looking for answers? Try searching our database.

HOW? Invoking the EVENTs of a CONTROL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lee Gillie - 09 Dec 2004 23:01 GMT
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
Ed Kaim - 13 Dec 2004 14:43 GMT
How are you manually switching tabs? Can you provide the code snippet?

> Can one invoke an event of a control?
>
[quoted text clipped - 9 lines]
>
> - Lee
Lee Gillie - 13 Dec 2004 21:24 GMT
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

> How are you manually switching tabs? Can you provide the code snippet?
>
[quoted text clipped - 11 lines]
>>
>>- Lee
Lee Gillie - 18 Dec 2004 02:18 GMT
Ed, are you there?
I gave you my code, do you have any ideas?

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.