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

Programmatically Click A Control

Hi there,

I'm try to click my Usercontrols Programmatically, this inturn should call it click event.

Does anybody know how this can be done.

Would i have to use the SendMessage API call??

the pig..

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Get The Name Of Control And Use It Programmatically

Im in the process of writing a module that logs what the user is doing within my app. I have a string containing the type of info (error, update, delete etc), date, time, form name etc that the user is currently using, but I'd like to report the control that the user has clicked as well. For example, if I click a command button called 'cmdSave' I want to be able to stick the name of this control in a var. and write it to a logfile, so that the output in the log file shows a description of what the user has been doing.

It's a but like Windows EventLog, but this will report more often. It's a way for me to debug my app when its used in a live environment.

At the moment I have all the code working - it appends to a text file and records everything else I need, I just need the control name. I get the Form name by using '' which is great. Anything I can use along those lines?

Cheers fellas

How To Create Control Array Programmatically?
Dear The Expert,

How to create control array programmatically? .. for example. MSCOMM Control .. for some conditions my vb6 application needs to create 5 mscomm control .. how to do this? .. please advise

thanks a lot


Using The Microsoft Graph Chart Control Programmatically
I'm trying to use the Microsoft Graph Chart control which I found on the components dialog box under Insertable objects tab.

What I'm trying to figure out is how can I link my flexigrid to the charts datasheet programmatically. I want to take columns 1 & 2 & 3 from my flexigrid and insert them into the chart control's datasheet, how do I do this?


Programmatically Passing Connection String Info To ADO Control
I have a VB6 program that was finished to the point of sending it to friends to debug. When I tried to deploy it, I ran into what seems to be a common problem of needing to programmatically passing the connection string and record source to the ADO control so that the user can select their choice of directory to install in. I keep coming up with the same dead-ends and programmers suggesting not using the ADO control at all and just accessing the database programmatically.
I can't believe there is no way to do this. The program works fine before deploying to a different directory. Several of the features I am using on these forms require the ADO control vs. no control.
I am using VB6 from Visual Studio, jet 4.0, access. I have all the updates from Microsoft.
All I really need is just a way of passing what it takes to initialize the ADO control in the program vs. setting it up during design time.
Any help would be greatly appreciated.
Mike Koch


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 !!!!!

I Need Help About Click Control
Hello Guys,
how r u all i hope every one will be fine and enjoying good health while reading my thread.Its my First post To This forum.Nowadays i m making a Game in visual basic 6 and the help i need is this I have a Menu Control in my Main form in which i have a sub menu control for colours.Like Options---->Colour------>yellow,Red,Blue,Green,Default . Now the thing i want to know is this actually i have 7 forms in my this game so i want to change the colour of all forms and buttons and controls in each form By clicking on a single menu color in main form.I have written the code in a way by naming all th forms and control names under Specified clicked Menu color. but it looks like a burden of code .Is there any way that i create a function Separately with less lines of Code. Any Help in this Matter will highly be Appreciated.

May U all Live Long Happily and keep Smiling always like fresh flowers.


Click Out Of Control
Hi. Im making a user control which has a few standard controls in it. I want it to do something if the user clicks out of it (when it loses focus) but using usercontrol_lostfocus doesnt work because one of the controls inside it might have focus. I cant put the even on those controls because then switching to another control within my user control would fire the event. Any ideas?

Click On A Control ID
For the life of me i cannot find an easy way to click on a specific control id in another program

i know the control ID and it is unique so therefore i have an advantage over simple x,y coords but it appears the function GetDlgtext is not reccomnded

the control is inside a dialog and i thought that would be the best way to click it
but after searching a bit its not a recommended function

id love to have something similar to autoits controlclick(control id as long) function but im at a loss on how to enum this control

thanks all

CONTROL's Name When Click On It
Hi All,

I am doing a project and need to get the name of the control when some body clicked on it. I am having different types of control arrays on my VB form.

Click On A Shape Control
Why doesn't a shape have a click event attached?
Is there a way to add a click event to it?

I really need to have some shapes on my form and click on them.
I need to put the shapes over some textboxes, so adding a picturebox and drawing a simple circle or rectangle, unfortunately, it is not an alternative.

Control Swf Mouse Click In VB
Hi All,

My project include shockwave object (swf). I want to control mouse events (move, down, up) on shockwave object in visual basic. For example:

mousemove on shockwave object, MsgBox("You are on flash movie")
mousedown on shockwave object, MsgBox("You are click to flash movie")

I try put transparent label over shockwave object, but label always down to shockwave object.

How can i do ?

Thanks for helps,

Shockwave 'Click' Control
Is there any way to get a click event out of a shockwave control? I would like to have a flash control (button) that, when clicked, loads a different form. Is this possible? Thanks

Right Click In VB Text-Box Control
I have a control that I am building and part of that control includes a text box control. When you right click in the text box I am attempting to display a popup menu that will display alternate values to place in that text box. The problem is that VB/Windows displays a "standard" popup menu prior to displaying my popup menu. This standard menu is a Cut - Copy - Paste menu, and after that menu is clicked on or away from, my menu is properly displayed.

Does anyone know how to disable this default popup menu for a text box. My system is Win2k and I am developing in VB6.


How Do You Make Your Own Control Click?
Hi everyone it is me again. Well I have made a button in photoshop and put it in a picture box. But then how do I get it to work for a click? Would you just put a transparent label over the button that I made or what? Well I would really appreciate some help here. Thanks and have a good day everyone.

Know If A Control Gotfocus By Click Or Tab
I need my prog to know if a control recive focus by clicking with the mouse or by pressing tab.

If tab is pressed then Causes_Validation should activate and depending on some stuff will change or keep the focus.
If left click, then the focus will change no matter what.


Tab Control And Right Click (RESOLVED)
I'm using SS Tab control. I'm just wondering is it possible to change tabs using the right mouse button and how to go about doing that? I want this because on right mouse click I have a menu that pops up and I want it to apply to the tab where the mouse is over, not necessarily the selected tab, so I need the right click to select the new tab. I hope that makes sense

How To Intercept A Click On The Control Box?
My program's main form has an exit button and exit menu which execute some code to quit the app in an orderly way.
However, I just realized this form can be hidden and execution apparently ended by means of a click on the control box, but it does nevertheless remain loaded in memory.

So the question is, what event is triggered by clicking on the control box that I could place the same code in the event handler?

Click On Internet Control
I am loading .htm file using internet control, I want to load some particular forms on click event of particular images? which are on this Html file. Is it possible to detect a click on .htm file

Thanks & regards


Active X Control On Click
I know this shouldn't be posted here : but I wasn't getting any response from the ActiveX and Asp sections of the site so I decided to try it here.

Is it possible to have an active x control "loaded" on the click of a button in an asp page? I don't want the control to be part of the page. What should happen is when the user clicks on a submit button, the control loads with some data that is passed from the page and the user can either print that data from the active x control or close it without printing>

Can this be done anyone?

Click Link In Web Control
i added a web (IE) control to my project, and i want to make the browser click a link when i press a command button, how can i do it? i dont just want to navigate to the link, i want the browser to "click it". Is it possible?


Right Click On User Control
On my control i'm making how can i get it to right click and show a menu??

Yes Click Control Needed
I need a "Yes" click control that will help me get around the Outlook security dialog box when my application wants to send an email, preferrably freware. I have seen a few that are pricey and a couple that are cheap, but the cheap ones will not allow you to taraget a specific application. Is the a way to write a VC 6 program to do this.. Please Help


Auto Click Tab Control
I am wondering is there a way to automatic select the tab from a tab control if you know the tab control handle number?
I try to use SendMessage but it does not seem to work.

Any Ideas?

Thank You.

Right-Click On 'Grid' Control
I am using "Grid" control on the form. It has several rows which are filled with data.

When I left click the row, It get selected.
But when I right click on the row, It does not get selected.?...Why this is happening. What Left-click does the extra part to select.

The reason why I am asking is I want to popup menu on the right-clicked row by selecting it.

I am able to get KeyCode on "Grid1_MouseDown" event.


Image Control Click Event
i am using VB .NET
I have an image control which contains a .ico file. (in a .aspx page)
on the click event of this control(in .aspx.vb page), i want to show another page, which is a web link.
how do i do it?

Referencing A Control On The Click Event
I have numerous labels in a project. when i click on one of the labels i want to change the backstyle of all the labels in the form except the one i clicked on. i was able to use "for each ctrl in controls... next ctrl" function to change all of the labels, but could not identify which label was clicked. I don't want to "hard-code" the label since i would have to do this for each labels click event. any suggestions?

Disable Right-Click On OWC Spreadheet Control
I have an Office Web Component Spreadsheet Control in a VB Form. I can't figure out how to disable the right-click context menu on the spreadheet control. Does anyone have any idea how to do this? I would like to be able to create my own right-click context menu... Is this possible?

Control Click Response Time
I have encountered a curious phenomenon regarding the use of the MouseUp and MouseDown events on a control. In order to show this I created a simple VB project with a single form, see the screen capture below, that contains a label control and a command button control. Within the form I added code for both of the controls to respond to their respective MouseUp and MouseDown events. Both controls are setup to change their background color in the MouseDown to a light purple color and to then return to a light yellow color in the MouseUp event. (Note that it is necessary to program the Style of the command button to "Graphical" in order to be able to change its background color).

Here is the code in the form.

Option Explicit

Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

Label1.BackColor = &HFFC0C0

End Sub

Private Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

Label1.BackColor = &HC0FFFF

End Sub

Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

Command1.BackColor = &HFFC0C0

End Sub

Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

Command1.BackColor = &HC0FFFF

End Sub
(Note that the above code is included in the attached ZIP file).

I noticed that when the program is run on my system that the color changes of the command button seem to track my mouse clicks for whatever speed I can click the mouse up and down. The curious problem came to light when I noticed that when i click on the label control the color changes do not track the clicks of the mouse button for all speeds that I care to click the button!!

Through a bunch of experimentation I have found that the response hesitancy of the label control can be changed by going into the Windows Control Panel Mouse Properties Applett and changing the "DoubleClick Time". When I set this property to the 'fastest' then the clicking on the label control seems to support changing the colors for as fast as I can click the mouse button. On the other hand slower settings severely limit how fast I can click on the label control to change its colors. In all cases of changing this parameter I was not able to detect any performance difference with the command button clicks.

I did note that when I set the fastest double click time for the property I was then unable to any longer use double-clicking on my computer for any applications that supported double click functionality. (This may be due to the fact that my fat fingers just cannot click the mouse fast enough!!).

What I would like to find out is if there is a way to get the label control responses to be similar to the command button control. Clearly there is some way that the command button foreshortens a previous double click detection time window interval by posting the next MouseDown as soon as it happens whereas the label control seems to have wait out the double click detection time before another MouseDown event is posted to the label control.

Preventing Right Click On Web Browser Control
How can I prevent right clicks on the web browser control preferably from within the VB program and not by adding a javascript to the loaded webpage?


Click Link In Web1 Control ?
Can you click a link in a Web1.Control? What about a submit button?


Click Event In Control Array
Hey there,

I created an image control array (at design time) and associated a different picture for each one to create a custom toolbox, like this:


Well, when I double-click over any image object to codify the click event, it goes to the code and shows Private Sub Image1_Click(). When I try to run the program, the compiler show the "Procedure declaration does not match description of event or procedure having the same name" error.

I know that it occurs because I have an array but the click event is referring to the images at generic way. What I don't know is how to solve that.

Any clues?


Do Something When I Click On A Textbox AND Hold Control.
I want to perform some action with a textbox.
It should happen when I click on it with the mouse button, but the action should only happen when the control key is down.

Searched alot, but couldnt find a simple solution.

How To Detect A Click On Web Browser Control?
hi everybody,

one new problem i couldn't solved after trying really hard.. i want to detect a click on my web browser control. when it detect that the user have click on the page, then it will let the user enter the main program. the code i think of is below.. but they dont work. actually it work but it enable the button as soon as the site load on the browser..

Private Sub Form_Load()
WebBrowser1.Navigate ("")
End Sub

Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
enterButton.Enabled = True
End Sub

so please help me....

Click On Control To Bring Up Another Object
I have one last issue with my application.

What I want to do is (using Code however not Properties Window) - I have a command button called Author Name (AuthName) and a label called imgLogo. The imgLogo has a property of false.

Now what should happen is: when you load the form the label is invisible, but when you press the AuthName command button it appears on screen.

But attempts at coding these controls is not working

I have played around with the code and I had to clear both the code on the command button and label. Both look like this:

Private Sub Command1_Click()

End Sub

Private Sub AuthName_Click()

End Sub

Private Sub ExitProg_Click()
End Sub

Private Sub imgLogo_Click()

End Sub

I thought that this exercise would be straightforward. I remember having a go at coding this event in text books whilst studying, but it's not happening.

Any assitance grateful.


Web Browser Control! How To Click An Image.
i want to click a button on an html page that is in the form of a .gif image using a vb application.

i know how to click html buttons using this code

VB Code:

but not sure how to do a .gif

Mouse Click On Webbrowser Control?
I'm using the webbrowser control and i need the position x,y of the mouse and to be able to click on a link of a specific position.

so pretty much mouse needs to go to a link position and click the link.

How To Right Click An Item In A Systeeview Control With Api?
Anyone know? I want to right click a certain item in a systreeview, and bring up the options menu

Control Array Click Event
i have an array of command buttons, how would i do a click event for them?

Custom Control Click Events
Although I've played with VB for many years I've never created a custom control before. I am designing a control with several textboxes and a couple of pictureboxes. I need to know when the user has clicked on a particular textbox or picturebox within the user control. At present I just have the standard click event for whole control. I guess it can be done using the mouse x and y coordinates from the user control's MouseUp event but is there a neater way?

Thanks for your help.


Help With User Control And Click Event
Hey everyone, I got a user control, not created by me, and the problem is the author of the control never really finished it, it looks as if he kinda just quickly put it together. I need to have a click event on the user control but dont quite understand how it works.

Here is an example of how the author used the KeyDown event:

VB Code:
Public Event KeyDown(KeyCode As Integer, Shift As Integer) Private Sub UserControl_KeyDown(KeyCode As Integer, Shift As Integer)' all keydown coding here...doesnt really matterEnd Sub

The thing is, there is no where through the rest of the code that triggers the KeyDown this an event that vb will automatically trigger? And if so, it shouldnt be hard to make a click event..

So any suggestions on what I should do to make a click event for the user control? Thanx everyone for the help.

How Do I Disable Right Click On Webbrowser Control?
How do i disable right click on Webbrowser control?

Disable Right Click In A Webbrowser Control
How can i disable the right click of the mouse in a webbrowser control?

***Resolved*** Control's Click Event.

Here's the question.

If I have the control's name stored in a string, can I call it's click event?

I don't want to iterate through the controls on the form and compare the names.

Is there an api call? SendMessage?

Disable Right Click In Webbrowser Control
How can I disable right clicks and scroll bars from webbrowser component in VB 6 ?

Click A Link With Webbrowser Control
How can I click a link with the webbrowser control after I have navigated to a page?

Click Event And Timer Control
Hello to all:

Being a novice at Visual Basic, I am trying to create a private sub that
will repeat or loop every 10 seconds that starts when a "Start" button is
clicked and stops when a "Stop" button is clicked. I am not sure if I need
to incorporate some kind of loop routine or can I use a timer control?

Any help would be appreciated.


WebBrowser Control, Right Click Menu
Hi! I use a WebBrowser control. I use WebBrowser.Navigate to display a web page. The usual IE right click menu is displayed when I right click over the page. Can I disable the right click menu directly from Visual Basic? I'm very grateful for comments!

Disabling Control On Click Of Checkbox
I have a checkbox (LocationDataCheck), and a text control (LocationDataEntered).  When LocationDataCheck is checked, I want LocationDataEntered to be disabled.  I've put the following code into the OnClick of LocationDataCheck:

Private Sub LocationDataCheck_AfterUpdate()
    If Me.[LocationDataCheck] = -1 Then
    Me.[LocationDataEntered].Enabled = True
    Me.[LocationDataEntered].Enabled = False
    End If
End Sub

I'm getting the error message "Method compile error". . .??

Copyright 2005-08, All rights reserved