Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Visual Basic

See Related Forum Messages: Follow the Links Below to View Complete Thread

How To Avoid Controls Click Events In Form Activate Event...
Is there any way to avoid the click event send that automatically Activate form event sends to all controls in the form???

Thanx in advance !!!!

SSTAB Click Event
I have a problem with the SSTAB Control.

When I click at a tab the first time I get a click event. If I click the same tab a second time i get no click event.

How can I solve this problem ?

Thx in advance

SSTab Click Event Problem
I have an SSTab control on a form, and I want to use the Click event to detect when a tab is clicked on. However, when I add a Sub to my program to detect this, I get the following error:

Compile error:
Procedure declaration does not match description of event or procedure having the same name.

Any ideas as to what might be causing this would be appreciated. I'm sure it is something simple, but my SSTab documentation is lacking.


VB Code:
Private Sub SSTab1_Click(intIndex As Integer, intPreviousTab As Integer)     If SSTab1.Tab = 3 And intPrintFormSave < 0 Then cmdApply.Enabled = False    If SSTab1.Tab = 3 And intPrintFormSave < 1 Then cmdSave.Enabled = False End Sub

Sstab On-click Event&gt;&gt; [solved]
Hi all, in my prog I have an sstab control. One of its container objects is a Listbox.

I want the list to be filled with data from the database when the correct tab is clicked (note there are several tabs - but I only want the listbox to be filled when a specific tab has been clicked)

is there an event for this? all I can find is the general:

VB Code:
Private Sub SSTab1_Click(PreviousTab As Integer)


How To Activate Certain Sstab ?
i have a SStab1 which has three tabpage and i want to activate and show ceratin tabpage on meeting a condition.

If UCase(ComboBox1.Text) = "PANT" Then
MsgBox(" This is tabpage number --")
' what should be the code here to activate and display a tabpage ?
End If

Double-click Event Firing Off Click Event Code?
For example:

In a listbox, I have a click event that changes a label's caption from 'Loaded' to 'Clicked' and changes the color from black to red.

I have a double-click event that shows a message box saying "I've been double-clicked."

You can re-set the label by clicking it.

When I click the listbox, the label's caption and color changes. This is what I expected.

When I double-click the listbox, the label's caption and color changes, and the message box is displayed. Why?????

Activate Event
The Form_Activate event should be triggered when ever a form is made the current window (eg. Click a different window, and then click the first window). Is this correct?

It seems that it will not respond like that for me. The activate event will be triggered only when the window is first opened and I cannot trigger it again.

Any insight would be appreciated.

Activate Event
How do I force the activate event to occur? We have an application here that used to have entirely modal forms, and the users were prevented from accessing the desktop or other apps while it was running. I am required to make all forms non-modal and minimizable so that users can now access the desktop. My problem is the activate event of each form is not occurring, just the load. What is the best way to handle this?

Activate Event
When is a activate event of a form really used?

Form Activate Event
I don't get Form Activate events (or Deactivate, Got/lost Focus events) when I swap to/from my VB6 app from another app. I should, shouldn't I!

Put a long, multiline label and a command button on a form
Put this in the form's code

Private Sub Form_Load()
Label1 = "Load"
End Sub

Private Sub Form_Initialize()
Label1 = Label1 & vbCrLf & "Initialize"
End Sub

Private Sub Form_Activate()
Label1 = Label1 & vbCrLf & "Activate"
End Sub

Private Sub Form_GotFocus()
Label1 = Label1 & vbCrLf & "Got Focus"
End Sub

Private Sub Form_Deactivate()
Label1 = Label1 & vbCrLf & "Deactivate"
End Sub

Private Sub Form_LostFocus()
Label1 = Label1 & vbCrLf & "Lost Focus"
End Sub

Private Sub Command1_Click()
Label1 = Label1 & vbCrLf & "Click"
End Sub

Run and click some other app and then back to the form..

Form Activate Event

I have a form where I store data to access db. After that I close the first form and open a second form (with vbmodal), where I try to read the data with data controller. But the data just isn't there. The problem is this (at least my guess is this) When the second form opens and the data controller tries to read from access db, the access table is not saved yet. I have also tried to refresh the data controller in form activate event, but it's not the solution because this form was in modal mode and the form activate event does not occur.

Can anyone tell how to solve this problem?

MDIFORM Activate Event
In mdiform On One Menu I have written like this


When I Unload Form1 then it comes again to Mdiform

Which event is firing when focus comes again to Mdiform
Because Activate Event is not firing


Form Activate Event
I have a code which pastes a large amount of information cell by cell from one excel sheet to another which takes a lot of time .I want to hide the process going on by putting a form in front with an animated gif in it.Please help.I tried with a form with lot of control on it and put my code in the form activate event but while processing the code,the form appears white and no control i diplayed.I don't know why .May be because the multitasking has been too much for my PC.Anyway I have deleted all control from the form and is planning to put animated gif.

Activate Event Of An MDI Child
I have an MDI application, I have set some forms to be MDI children(FormA and FormB). This is the scenario. I click a button on FormA to open Form B. I am using Now from FormB I want to open FormA. So I use My question is why is the activate event not firing on FormA when I called it to open from FormB, I have code under the activate of FormA and I need this to fire? Am I doing something wrong? I hope this explanation is not confusing.

Thanks in advance

Click Command To Activate Timers...
Basically what the title suggests, how do i go about creating a command button, so when clicked on, activates a timer or a number of timers?

Thanks, i am very new to visual basic so please take it easy on


Activate Right-Click Menu In RichTextBox
How do I activate the right-click menu in the RichTextBox?

How To Trigger Activate Event Of A Form?
I have 2 exe programs.
prg1.exe = calling program
prg2.exe = program to be called

prg1 code to call prg2:

VB Code:
' Specifying vbNormalFocus as the second argument opens the application in ' normal size and gives it the focus.Dim RetValRetVal = Shell("C:WINDOWSprg.EXE 0001", vbNormalFocus)   ' Run prg2.  

prg2 code to unload, back to prg1:

VB Code:
'there is some others code before Unload Me'Function WriteInfoToINIFile()Unload Me

After prg2 Unload, the prg1 back its previous state and need to change some data depends on the written data from INI File by the prg2 upon the prg1 activate the program.

The Activate event of prg1 is not triggered upon activation.

The Activate event occurs when an object becomes the active window. But moving the focus to or from an object in another application doesn't trigger either event.

Favors to the group:
1) Please give a hints on how to trigger activate event switching between 2 applications.
2) If you have other way to meet the requirements, much better. Please teach me.
3) Also upon calling the prg2, the user should not able access prg1. Its like with calling other form using Show method with vbModal. But it is within the application.. How about between two applications. (maybe Hiding the prg1 first before calling the prg2 then show it again after prg2 unload.

Thank you very much.

DataReport Activate Event . . . ***RESOLVED!***
I can't seem to get the DataReport's activate event to fire.

I want to change the caption of my PageHeader at runtime. I put in the MsgBox "hi" so I would know if the event fired.

I have tried setting focus, resizing, etc. What am I missing?

I tried to change the caption during the Initialize event but that gave me a "Variable not defined" error on the lblAudit part. For some reason it can't reference the control when it initalizes .

VB Code:
Private Sub DataReport_Activate()    lblAudit.Caption = ""    DoEvents    rptROEA_Audit.Refresh    MsgBox "Hi"End Sub

Anyone ever changed the label caption on a DataReport at runtime??

(man, I hate VB reports!)

Can A LostFocus Event Be Selective? I.e Don&#039;t Activate If This Happens.
I'm trying to use the LostFocus on a couple of text boxes to auto-populate some other text boxes. Everything works ok as long as valid data is entered. But I'm trying to trap invalid input. Here's the gist of the program.

Text1 "Enter Warehouse Code".

When Text1 loses focus Text2, the warehouse name, is populated from a database.

Text3 "Enter Part Number"

When Text3 loses focus Text4, the part description, is populated from a database.

The problem is if an invalid warehouse code is entered. If the warehouse code doesn't exist in the database a message box pops up stating "Warehouse Code XXXXX Invalid". But the focus has moved to Text3 via the [TAB] key. When you back-tab to Text1 to correct the warehouse code, Text3 loses focus and tries to find a blank part number in the database. A message box pops up stating "Part Number Invalid".

Question 1: Can I make a losefocus event happen except if something else happens?

Question 2: Is there a better way of doing what I'm trying to do?


A computer is a tool, not a toy.
<A HREF=""></A>

Screensaver Activate/Deactivate Event
Hi there,

Does anybody know of a way how I could create an event which fires when the screensaver is activated and deactivated.

Many thanks

Edited by - glennandrewcooper on 2/8/2004 3:27:37 AM

Form Activate Event Not Firing
Well I'm facing a very peculiar problem with my MDI app. When the application starts the first time and I invoke any MDI child, the activate event of that MDI child does not fire. However, if I again reopen that MDI child or any other MDI child, the respective activate event starts firing. Can anyone explain this problem?

Activate Event Called Only When Program Is Compiled.
Greetings all!

I ran into a really weird problem that took me about one day of work to fix. Byt the thing is, I still don't understand why I got this weird behavior!?!?!?!?!? So I tought that maybe some of you could provide me with another plausible explaination than my computer is posessed!

I work with MDIforms. When I click a button, it is supposed to open a form. So, what I do is loading an MDIchild into a collection. After doing that, I call a my custom function "LoadData()" from the MDIchild to load some datas (duh! that really sounded like a bad help file I read once...).

Now, here is the funcky part: when I run from the .exe file, the sub "Form_Activate()" is called right after my function "LoadData()". BUT, if I run the program from the VB developpment (I call it debug mode...) environment, "Form_Activate()" is NOT called!!!!

If anybody could tell me why the behavior is different between compiled version of the app and the debug mode, that would be great!!! Or, at least, if someone have seen something like that, just tell me cuz I really think about calling a priest so he can exorcit my computer!!!!


How To Activate An Event Of A Form In A Function **Resolved**
Hi all,
I have a function. In this function I would like to call a form. the form has a text box and a command button.

The doubt is how to actuate the event procedure of a command button in the called form with in the function.

What Would Prevent A Form&#039;s Activate Event From Firing?
I have inhereted a MDI app here where I am observing strange behavior with a form. One child form (let's call it Form1) calls the Show method for another child form (let's call it Form2).
When Form2.Show is executed, the Load event for Form2 occurs, but the Activate event for Form2 does NOT fire as expected. The result is a partially visible Form2 (with controls missing, etc.) with Form1 behind it. If I click on Form1, then click back to Form2, Form2's Activate event fires and the program proceeds normally. I have coded a work-around that works, but I'm puzzled as what is going on.

My work-around code is:
(In Form1)

Any ideas?

Text1 Changes, Activate Code In Timer Event
When the contents of text1 change, I want my code underneath a timer to execute, so at x interval, the computer will emit a beep:
Private Sub timer1_timer()
End Sub

This is just the obvious code­.. now how would I go about the rest?

Error Occurs When Txtbox Has Setfocus Within Activate Event

I have a form with a txt box on in my code, I have placed
the setfocus on the txtbox within the activate event but this appears to return an error..."Invalid procedure call " - as anyone
any ideas?????


my code

VB Code:
'set the focus on the txtbox upon form activationPrivate Sub Form_Activate()    On Error GoTo Form_Activate_Error       txtinformation.SetFocus    On Error Resume Next          On Error GoTo 0   Exit Sub Form_Activate_Error:     MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Form_Activate of Form frmscan"End Sub


Activate/Deactivate Event Doesn't Fire When MDI Child
Please someone help me,
my problem is the following:
i had a nice application (it still is), but my boss wanted it to be an MDI Application, I say: 'No problem' and start changing some forms to MDI Child, but now, when my form is MDI Child, it DOESN'T do the (de)activate event, how is that possible?
Any ideas are welcome

Search before you ask - if you don't know where to search, ask before you search

Activate ListBox Dbl_Click Event Without Clicking On An Added Item.
Is it possiple to activate the listbox double_click event without clicking on an added item. i.e. if the user dbl clicks anywhere in the listbox. I can only get the event if I dbl click on an added item.

Mouse Up Event Misfired In The Righ Click Event Of The Flexgrid! Help Needed

When the user right click the first column of the MSHFlexgrid then a PopUpMenu rises, for that i coded as below. But when the user click the row header which i used to display the Serial No. there also the popupmenu rises. how to avoid this. I am using the below code to identify the First column of the grid and rise the popupmenu.
so i am getting problem. because when the user click a item in the popupmenu then i the next form is show with the value of the MshFlexgrid FirstColumns text..

Private Sub MSHFlexGrid1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)

    If Button = vbRightButton And MSHFlexGrid1.MouseCol = 1 Then
        Me.PopupMenu mnuReport
    End If

End Sub

How to solve this problm. Kindly suggest your idea.

Thank you very much,

<B><font color="#008000">HAVE A NICE DAY !</font></B>

Datagrid Click Event, Dbclick Event.
I have a datagrid that when I double click on a line it display all the information linked to this line in text box.  

I would like to do the same thing with the click event. So when the user click on the grid I call the even dbclick.  But the thing is that the click event doesn't seem to have selected the right line yet.  Because when I only click it display the information about the old line.

For example I'm on the line1
when I click on the line2 it display me the information of the line1.
Supposed that I still on the the line1
I dbclick on the line2, it display me the information of the line2. (as it supposed to)

I call the same procedure for both click and dbclick event.

Does somebody have any idea how I could solve it?
Thanks in advance

Distinguishing SStab Click
I have a sstab control with about 11 tabs, and what I'm trying to do is that when a user clicks on a tab I would like to set the focus to the first control on that tab.
I see on the
SSTabSubChkList_Click(PreviousTab As Integer)
it will give you the number of the previous tab, however I can't figure out how to get the number of the tab you just clicked on?
Because while it might be useful to know the number of the previous tab, it isn't guarenteed that the user will click in order.

Any help is greatly appreciated!!

SSTab Tab Change Event
is it possible to do something when the user changes the tab in an sstab control? How?



SSTAB Show On Button Click
hello experts
i have a a 6-tabbed SStab control on one form, and from another, i wish to view the separate tabs on clicks of diff. buttons. since the tabs don't have their own individual name, can you please tell me the way of doing this?

SSTab Double Or Single Click
I am using the SSTab in my design, but it is a double click. I want the tab to be a single click. Is there any way to change this functionality of the tab.

Thanks in advance!

SSTab Click On Frame To Active A Different Tab
Hi All,

I have a SSTAB1 active with 7 tabs setup.
On the front tab(0) I have six frames with text and labels in each, describing very briefly the reason for the other 6 tabs.

Is it possible to click on the frame to activate a different tab. So say I'm on the tab(0) by clicking on the second frame on tab(0) is it possible to make tab(3) become the active one?

If so, how do I go about this?


How Can I Click A Button, Then Jump To The Second Tab Of The SSTab?
I have a SSTab and has several tab I define. How can I click a button, then jump to the second(or third) tab of the SSTab?

Best Regards,

Kevin Shen

Form_KeyDown Event With SsTab Control
Having problems with receiving KeyDown event on Form (KeyPreview is enabled on form).

There is an ssTab on the form and when it has the focus and a key is pressed, the Keydown event is generated twice.

If you step through it in the basic, as soon as the first End Sub has been executed the next Keydown event starts, so there is nothing happening in between.

If you click on another control and give anything else the focus, the problem goes away.

any ideas??


Validate Event Not Triggered With SSTab
I placed 2 text boxes on one sheet of an SSTab control.
When the user switches tabs the Validate Event is not triggered.
Does any one have a solution?

Checking Right Click In Click Event?
Is there any way to detect a right click in a something_click event? I'm trying to do something on both right click and left click for a menu but can't figure it out.

Click Event Executing On More Than Just A Click!
Morning all.  On my form today I have a checkbox that can enable or disable a combo box.  For this I am using the Click event of the checkbox then an If statement to check its own state and enable/disable the combo.  I have a problem however - this check box is also toggled by another event (it's reading data from a recordset) and this also seems to trigger the Click event!  I only want the event to trigger if the user actually clicks it with the mouse - I have tried MouseUp and Down... Any ideas?

Lostfocus Event After Click Event
If you use the accelerator for triggering a command button click while focus is on textbox, the command button click goes through first before the text box lostfocus. However if you actually click on the Command button the text box lost focus happens before the command button click which is the right sequence.
How to get the sequence right in the first case?
One way is to do a setfocus in the command button click to itself and issue a DoEvents. But I want to avoid DoEvents since that could lead to triggering of other unexpected events.
Thanks in advance.

Raising The ActiveX Control's Event On The Click Of The ActiveX C Ontrol's Sub Form Buttton Click
Hi Friends,

I am designing one ActiveX Control with a lot of sub forms which r shown on
calling the methods or from some other events.
I want to raise few event of this ActiveX Control on the click of any button
of ActiveX control's sub form.
I want to give the user of the activex control some development control
with the help of these events.
I am not able to access the events (defined in the user control at design
time) of the activex control from the sub form of the activeX control.
Can anybody tell me how to do that.

Thnx in advance,

Naveen !!!!!

Raising The ActiveX Control's Event On The Click Of The ActiveX C Ontrol's Sub Form Buttton Click
Hi Friends,

I am designing one ActiveX Control with a lot of forms which r shown on
calling the methods or from some other events.
I want to raise few event of this ActiveX Control on the click of any button
of ActiveX control's sub form.
I want to give the user of the activex control some development controls
with the help of these events.
I am not able to access the event (defined in the user control at design
time) of the activex control from the form.
Can anybody tell me how to do that.

Thnkx in advance,

Naveen !!!!!

Validate Event On Textbox Within Sstab Not Firing When Changing Tabs!
I've noticed an odd problem with VB6 where validate events won't fire from text boxes (haven't tried any other controls, though). If I click on a different control like a command button or another textbox, the original text box validate event fires, but if I select another tab, the validate event for the text box does NOT fire! The sstab causesvalidation is set to true. Anyone have any workarounds for this? If not, then I'll have to validate all of the text boxes manually when I want to close the form and save the data. Yeecccchhh....

Thanks for your help!


How To Automate To Detect A Left Mouse Click Without Using The Form Mouse Click Event
hello all ,How do I automate to detect a left mouse click without using the form mouse click event ?

Activate, Ye Stubborn Cell! ACTIVATE I SAY!!!
I'm glad to have one of my trademark needlessly complicated issues to present to you all. In my form is a combo box ('EventMenu'), two text boxes ('AskIt' and 'Moofus') and a button. Nice users will enter a string into the 'AskIt' box and my program will find the cell (all I really want is the row) where that string is found. Users also will have entered text into 'Moofus'; and this text will be entered into a cell on whichever row the AskIt string was found. Which cell, you ask; for there are many. Which cell the Moofus string ends up in depends on what the user selected from the EventMenu combo box.

Here is the script for when the button clicks:

Private Sub Findit_Click()
Loogit = Askit.Value
Hepcat = Moofus.Value
Set C = Worksheets(1).Cells.Find(Loogit, LookIn:=xlValues)
Showit.Value = C.Row
If EventMenu.SelText = "ONSITE" Then Cells(C.Row, 13).Activate
If EventMenu.SelText = "STARTUP" Then Cells(C.Row, 14).Activate
If EventMenu.SelText = "LOAD" Then Cells(C.Row, 15).Activate
If EventMenu.SelText = "MKEY" Then Cells(C.Row, 16).Activate
If EventMenu.SelText = "PROD" Then Cells(C.Row, 17).Activate
ActiveCell.Font.Bold = False
ActiveCell.Font.Size = 10
ActiveCell.Value = Hepcat
End Sub

In my dream world, they enter 1234A into AskIt and the program finds 1234A on row 11; the user selected "MKEY" from the Menu and thus the cell at R11C16 is activated and populated with Moofus.Value.

But all that happens instead is that the Moofus.Value ends up in whichever cell was active when I ran the macro.

Wha happened?

Click Event

I'm fairly new to VB and I would like some help with the following:

I have 3 combo boxes on a form. Only one is visible at form load.
I want to display one of the others depending on what is clicked in the first combo box. I dont seem to get the click event, in other words how do I determine that there was a click on combo box 1?

Thanks for your input

Click Event
Can someone tell me how to detect if the user has click on a label?

Right-click Event
How do i access a right-click event? I want something to happen when i right-click a label.

Copyright 2005-08, All rights reserved