Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old April 19th, 2004, 01:44 PM
Authorized User
Join Date: Jul 2003
Location: Montreal, , .
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default Form events

Could anyone tell me what event to use after I change .Visible from False to True? I need to trigger my function every time Form is visible.

Thank you.

Reply With Quote
  #2 (permalink)  
Old April 19th, 2004, 03:57 PM
Authorized User
Join Date: Dec 2003
Location: Middletown, CT, USA.
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts


Reply With Quote
  #3 (permalink)  
Old April 20th, 2004, 12:31 PM
Friend of Wrox
Join Date: Jun 2003
Location: Alameda, ca, USA.
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts

VB forms do not expose a OnVisible event (as well as many others we wish it had). You have two choice, as far as I know: subclass you form and find the right event, or just put a timer (half a seconds or so should be enough) that checks when the me.visible changes. Remember to enable the timer in the Load event and disable it in the unload. You can find good subclassing components at a reasonable price, chip ones so so, and very bad for free. If the application is simple and you feel to have enough time, you can also roll your own.
Reply With Quote
  #4 (permalink)  
Old April 22nd, 2004, 07:06 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG

There is no ON VISIBLE event in Access, so what you have to do is at the time you actually change the visible property of the control, then you ALSO run the code you want.  For example, let's say you have a textbox and you want a button to be visible if the textbox is not null, You would put this on the textbox's AFTER UPDATE event:

Me.cmdMyButton.Visible = Not IsNull(Me.txtMyTextBox)
But then you want some other code to happen for the button, but there's no ON VISIBLE event for the button.  You'll have to take care of it at the textbox's AFTER UPDATE event along with making the button visible/invisible:

If IsNull(Me.txtMyTextBox) Then
   Me.cmdMyButton.Visible = False
   'Run some other code here
   Me.cmdMyButton.Visible = True
   'Run some other code here
End If

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
"Delete Events" in Form Do Not Execute tcarnahan Access VBA 3 November 12th, 2003 09:06 PM
help with Events egiblock JSP Basics 0 October 6th, 2003 11:39 PM
capturing form closed events alexferrie C# 2 June 17th, 2003 10:53 AM

All times are GMT -4. The time now is 08:14 PM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.