Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 9th, 2006, 06:47 PM
Authorized User
 
Join Date: Nov 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default Combo Click event triggered unexpectedly

In response to the user selecting an item from a dropdown list, a value is assigned to another dropdown list on the same form. When this assignment is made, it triggers the "click" event for that other dropdown. Why should this be?

Code:
Private Sub Step_Click()
        Select Case Step
        Case "New Diameter"
            Transition.Visible = True
            TransitionLabel.Visible = True
            Transition.Text = "Step"
        End Select
End Sub()
The line Transition.Text = "Step" triggers the Transition_Click() event, and in doing so, generates an unrelated error.
 
Old December 11th, 2006, 06:26 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

this is how VB works: you change something in a control and automatically VB fires the related event for that control. The simple way to avoid this is to use a global boolean variable and set it before changing the property, reset it after. In the event of the other control, check if that variable is set, and if yes exits the sub right away

Marco





Similar Threads
Thread Thread Starter Forum Replies Last Post
CommandBarButton Click Event iprovalo Excel VBA 2 April 16th, 2008 02:52 AM
right click mouse event sen22 ASP.NET 2.0 Basics 5 December 16th, 2006 08:46 AM
event triggered when any control changed hoen Access VBA 7 January 24th, 2006 01:44 PM
Click Event dkr72 C# 3 December 8th, 2004 06:23 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.