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

VB6 And Onclick Event

Once upon a time I had some code that would capture the html onclick event of the webbrowser and open a vb6 form, but like with everything else I once had I lost it when my hard drive crashed awhile age and I lost it. I have searched and searched the internet and every other place I can think to find it again but I cannot locate the code. If someone on here knows how to do this or knows where I can locate this code again I would be appreciate it very much.

Thank you

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Onclick Event
I am working on an application that is a skin for internet explorer. I need to be able to present the user their page in HTML,XML... and have then select items from that page and assign them to items on my document. Trouble is I cannot seem to figure out how to fire the onclick event and once I get that I am not sure if it is possible to find which item was clicked. Here is my code so far

Set ie = New InternetExplorer
ie.Visible = True
ie.Navigate2 "" '"Z:InternetStuff ry.html"
Set htmDocument = ie.Document
'parse out the document here'
but how do I do an htmdocument.onclick event? Do I need to do a timed look to check its state or what? I cannot find any information on this.

BHO Onclick Event?
how can BHO detect if user has clicked mouse on html document?
could some one give an example of onclick event for BHO?


OnClick Event
For some reason I am drawing a huge blank on how to turn my ending messages into an onClick event. I want the messages to fire when the save button is clicked. Can anyone look at my code and give some thoughts?

Automate OnClick Event In IE From Within VB
I have about 50 virtually identical Intranet forms to complete and post - I have all the information to fill them in stored in an Access database.

I want to automate this process from within VB by using the Web Browser component. I have made a basic connection to the required web page, and I have been able to populate text controls on it using code, but I am getting nowhere when I try to simulate the click of the 'Continue' button on the web page. I have searched everywhere for some code.

I have tried using the FireEvent method within my vb code but this does not work:

bdone = doc.All("btnContID").FireEvent("onclick")

should I be looking at forcing the submit event instead?

Can anyone help?

ASP Button Onclick Event
Hi to u all,

i'm new to asp and vbscript here is my prob when i click a button i want to retrieve stuff from a db but when i use call myfunction it comes back with the error myfunction type mismatch not handled can someone please help me here how do you call a function or procedure when jou click on a button

thanx alot guys

OnClick Event For Tabs?
I have a form with a tab strip on it.

I have 4 tabs on the tab strip and they are all on the same level (in line with eachother), tab a, b, c and d.

Also on the form i have three buttons, 1, 2 and 3.

I want the all buttons to be enabled when the user views tabs a and b, but i want buttons 2 and 3 to be disabled when the user views tabs c and d.

at the moment all the buttons are enabled all the time.

the user is free to flick between all the tabs in any order.

i know how to 'turn off' a button...

buttonName.Enabled = false

i just need to know how to catch focus to each tab - and then depending on that, enable/disable the button(s).

any thoughts on how to do this?

OnClick Event In Word
I know that no such thing exists in a hperlink field in Word but seriously how do you trap the mouseclick event in the Hyperlink field codes to run a function to parse the hperlink address or for any other use???

Trigger Onclick Event In Html?
Hi all,

I have a html file with onclick event scripts, is it possible to trigger the event in VB? How could I do that?

<a href="#" onclick="transform('case1')">Case 1</a>

Thanks for help!

Call Javascript Onclick Event

I need to call following piece of javascript from vb.  I don't mind if web page loads into instance of IE or webBrowser.

type="radio" name="gettype" value="T" onClick="setA('typeA', 'T');


Want A Onclick Event That Prints To Adobe.

I want to print a report based on a click event on a form. I am using MS ADP, it does not provide us an option of
DoCmd.PrintPreview. It gives the option of DoCmd.Printout.

I have a form that the data operators enter, then they click the button. The button needs to refresh/requery the form that is updated and then show it in the print preview form using Adobe (if there is any syntax for this option) else preview would be good enough.

Any suggestions please


Sorting Data In XSL On Onclick Event..
How can I sort my data using onclick event? I want to sort my data like xsl:sort function can... but i think there's no way to do that on the onclick event, Is there anyone here who knows how to sort data with onclick event... thanks..

N00b Question - What Code To Put In 'onclick Event'?
I have made a DHTML program, with an interface for adding records to a database on DHTMLpage1. What I want to do, is have a button on this page, that when clicked, takes you to DHTMLpage2, which will be used for searching the records you added.

So what code needs to go into the below function? I've tried some combinations of things that don't work .

Private Function Button1_onclick() As Boolean

End Function

Attach Code To Onclick Event In A Webpage..?
How do i attach an function in VB that should execute when the user
is clicking on an button in the webbrowser window?
I know how to set the value in an inputbox in the html document but
how to connect to any ON..... event?


How To Display A Calendar In MS Access With An Onclick Event From A Text Box On The S
I have created a page in MS Access with a Date field linking to a table, a calendar object (Calendar 11.0) from MS Access, and a text box that I want to click on to make the calendar visible. I have made the calendar hidden when the page opens. Microsoft Script Editor inserts this into the HTML:
<SCRIPT language=vbscript event=onclick for=Text1>


If I add a MsgBox message in there, the message box displays when I click.
How do I get the calendar which is an activexctl to display? I have tried everything I can think of but nothing works.


Fire Onclick Event On Asp Page In Webbrowser Control
Hi all:
I am not a hardcore VB programmer so hopefully there are some experts out there who can help.

I have a VB6 form with a webbrowser control on it. When the form opens, the control is loaded with an ASP login web page. The user then logs in to the website and a second page loads. The second page has 3 frames. One of the frames has a disconnect button in it. If the machine is idle for a period of time I want to fire the onClick event of the disconnect button on the web page.

Tracking the idle time is easy enough but is there a way to fire the onclick event of a button in a frame on a web page in a webbrowser control?

Thanks for your help

How Do I Call The Onclick Event Of A Link In An HTML Page From VB???
can someone provide me with an example?

Thanks in advance.

Here's an example of the html page

<TITLE>Test File : IC * Load Log</TITLE>
<H1> Folder Name: IC * Load Log</H1>
<TABLE id="table1" border="1" cellpadding=1 cellspacing=1>
<td bgcolor=#C0C0C0 style= Font - Weight: Bold >Custom Field Name</td>
<td bgcolor=#C0C0C0 style= Font - Weight: Bold >Table Name</td>
<td bgcolor=#C0C0C0 style= Font - Weight: Bold >Tab Name</td>
<td>1<b><u><A id=1304 ; href=fielddetail.html#> <font color=0000FF>Load Process Time Start</A></u></b> </td>
<td >IC Load Log </td>
<td>2<b><u><A id=2 ; href=fielddetail.html#> <font color=0000FF>Dataset Code</A></u></b> </td>
<td >* MASTER * </td>

Triggering The OnClick Event Procedure Of A Field In Another Form
I need a little help! I am using VB for Applications with an Access Database and I am trying to trigger the onclick event of a dropdown box in another form. Here is my code in the click event of the button I am using to do this. It already opens the other form and adds the value. I just need it to trigger the onclick event procedure to call the code to retrieve the data in the associated controls without the user having to manually click the number in the dropdown. I think this should be simple but for some reason I just can't get it to work. Help please! Here is my code for my button so far.

Private Sub cmdDetails_Click()
On Error GoTo Err_cmdDetails_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmDraftingNew"

DoCmd.OpenForm stDocName
Form_frmDraftingNew.oitemID.Value = Form_frmItemsPriorToProduction.oitemID

Exit Sub

MsgBox Err.Description
Resume Exit_cmdDetails_Click

End Sub

I am sure it has something to do with Server/Client Side scripting
but i can not solve it

When a user clicks a Radio button I want to get the value
so I called the ans() sub onClick Why is this does not work?

<FORM ACTION="Grade.asp" Method="post" id=FORM1 name=FORM1>
<% Response.Write rsRecord.Fields("TheQuestion")%>

<br><br><B>A )</B>
<INPUT TYPE="radio" NAME=radio1 VALUE="A" onclick="ans()" >
<%Response.write rsRecord.fields("ans1") %>

Sub ans()

response.Write "<radio1.value>"

End sub

Thanks in advance

ASP OnClick Help Please!
OK, I have a Listbox search form onmy ASP page.

What I need is to check to see if either "Actor Last Name" or "Director Last Name" was selected and the action would change to a separate page for both of them (actresults.asp or direcresults.asp)

I'm not very good at coding, so could someone help me with this VBScript OnClick handler?

Can I make a macro run when clicking in a cell?

Textbox - Onclick
I have a form which has unbound text fields and in another and in that form I have a sub-form that I have sub-Query. In the main form I also have command button. I want query data using the value that user enter in the text box and by clicking the command button. I tried so many way but I cant get button to recognize the data in the text box.(The data in the textbox relate to a field in a the subquery). Any help on this will be greatly appreciate. (I am new to VBA stuff, so sorry if this question is too low for this forum)

Running A Function OnClick
I have a form that will search through a large number of records. I essentially have a text box for each field in the table, and they all have little check boxes to turn them on or off depending on what fields you want to search by.

The issue being there is about 20 fields, and my module is FILLED with all these 2-3 line functions for all the OnClick events of each of the check boxes to enable the search inputs.

I KNOW that I can set it up so the majority of the check boxes could be dealt with by one function. I was wondering if anyone knows of a way that I could set a public function to be used instead of the [Event Expression] or macro.

The base form of the issue: I would like to be able to turn on a text box, based on the status of a check box, without using a macro, or cluttering up my module.

Thanks for any help you can provide.

OnClick - Inserting Into Database
I want to have a button on my form in which if the user clicks it - it will take information from various textboxes (i.e. textbox1, textbox2) and INSERT this data into a microsoft access table (or can VB have it own't table/db to store this).
Just looking for a small example of how this could be possible.

Thanks. Also if it could be done with VB and not using Access - since I will probably get into trouble when I package the application for usage- will likely need to include the seperate db then.

Thanks again.

OnClick Make Txt Empty
trying to find out how to do this, when the program is running, if u click in the txt box it makes it empty (from the default message)

like, if i have a txt box that says "enter your name" and u click in the box to enter your name the box becomes blank

any help?

Tooltiptext Delay / Onclick

ive tried searching the forums already, i hate to bother you with this small problem.

In my programme, id like the tooltiptext to appear almost immediately. I thought of 2 ways to do this:
1) show the tooltiptext on clicking on the element (ie labels/images)
2) show the tooltiptext with a smaller delay

i found no answers to the first or second solution

does anyone else know how?


one other question

i have a tabcontrol on my form, with several tabs. can i make it when i click on a tab an event happens?
that might look easy, but try it yourself, it isnt., there is no click event for a 'tab', but there must be a way around this...

Triggering An OnClick Of Webpage
Just wish to know alternatives on how to trigger something like the ff. code found in a webpage...

<INPUT onclick="document.searchForm.submit(); return false;" type=image src="button.gif" value="Submit Search">


Note to moderators: I've double posted (in .Net) since I am open to any reply either in .Net or VB6.0...

Using OnClick With Control Arrays
i have a problem with making my strategy game.
i have an array that will hold all the pieces (red), and the pieces have names like red(0), red(1), red(2) etc.
is it possible to make separate onClick events for them?
i have tried but it seems to apply for all things in the "red" array.
please help

Lines - OnClick Events
Yo yo yo

I want to allow a user to redraw the position some lines (Y2, X2) - click on the line and then click on where they want it to be. But the line does not support the click even.

How can I work around this??

How To Open *.cpl Files OnClick
How can I open and CPL file through visual basic i tried using shell (Shell("C:windowssystemmodem.cpl") but in vain , but i could able to open exe files using the above command can anybody help me out.

VB OnClick In MS Excel 2000
I was wondering if anyone has an idea first if it is possible to execute vb code in excel just by mouse clicking on a cell, and if so how would one go about doing this? I am familiar with macros, but they need to be run from the menu or frompressing certain keys. This isnt what I want, what I would like is to be able to click on a celll from oe worksheet and have the contents transfered into another worksheet. I know copy can do this, but with the amount of data it would be significantly faster if I could just click and transfer.
Thanks for any info you can give.

Assign OnClick-Procedure To Every Button

I have following:

for each ctl in me.controls
ctl.onclick = newSub()
next ctl

Sub newSub()
... some Code ...
end Sub

However this doesn't work. What do i have to do to make that working?

Map Editor - Adding Images OnClick
I have posted this before but it wasn't answered, and it got old. A more detailed explanation should help.
To begin with, I have tried tutorials on Arrays and I don't have MSDN (Microsoft hasn't sent me a copy yet I asked for one already) I did not understand the tutorials and I would greatly appreciate an example, (written or send me a VB6.0 VBP file please)

This is basically what I am doing.

I have a button and when you click on the button, it changed your mouse-icon to a tree. Now, whenever the user clicks ANYWHERE on the form, I want a small picture of a tree to appear there, in the spot they clicked. I'm aware this is arrays, or something, but I need to know how to do this , and how to determine where the user clicked (X, Y) please an thank you very much, I've asked nicley and I've tried tutorials and other resources. I would greatly appreciate an example.

Thank you all

[VB6] Onclick Change Background Picture
how do i change the background picture on click on label?

Change Button Color Onclick
dear all,,

how do i change the button colors when i click on the button?

SSTab Or Tabstrip - How To Stop Tab Change In Onclick()
I have an application which asks for user input.
In it, there is a screen/form which is using a Tabstrip or an SSTab.
(I have tried both, but can't get either one to do what I want).

The SStab (or tabstrip) has 5 tabs.
On each one is a different set of information which the user must enter
different information.
The idea is,
they must enter the info on tab1 FIRST, before proceeding to tab2.

After they enter the info on tab1, then when they click on tab2 (or any other),
I invoke an editing routine to validate the info.
If the info is NOT valid, I give them an error message,
and return them to tab1.
I can handle the going back to tab1 by setting a boolean and testing
for it's value to see if we have been here before or not, to stop a loop.
This works just fine.

BUT....... (dammit), the tab they selected SHOWS up first,
then my error message shows, then they go back to the offending tab.

How can I STOP the selected tab from showing, unless they pass my edits ????

In other words, how can I interrupt the process of showing the selected tab ???

Thanks for any ideas

Access ListView OnClick Not Working Correctly
Hi. I am trying to find out which row is selected when someone lcicks in an access list view - but for some reason although it works when a button is clicked it doesnt when a list view is.

This bit on code:


Me!cmdQuantDown.Enabled = True

Dim ctlSource As Control
Dim count As Integer, count2 As Integer, newInt As Integer, intOld As Integer, RecID As Integer
Dim strSQL As String
Dim rec As Recordset

Set rec = CurrentDb.OpenRecordset("tblTemp")
Set ctlSource = Me!SelectedList

For count = 0 To ctlSource.ListCount - 1
If ctlSource.Selected(count) Then
For count2 = 1 To rec.RecordCount()
intOld = ctlSource.Column(0, count)
RecID = rec.Fields("id").Value
If intOld = RecID Then
newInt = rec.Fields("intQuantity").Value
newInt = newInt + 1
rec.Fields("intQuantity").Value = newInt
If ctlSource.Column(2, count) = ctlSource.Column(3, count) Then
Me!cmdQuantUp.Enabled = False
End If
Exit For
End If
End If

ctlSource.RowSource = "tblTemp"

in the listviews click sub wont work (increase a number by 1) but when used on a button it does. The problem is it wont go past the
If Me!SelectedItems.Selected(count) Then

If anyone could help me it would be HIGHLY appreciated - this is one of the last things i need done for my coursework!


Detect Duplicate Values OnClick In VB (excel)
Hi All,
I am fairly new to VB and I'm stuck. I'm trying to detect if an ID (located in ID.text) is already in a sheet (RawData or Sheet2) column C. I have put this together but have had no luck making it work.. PLEASE! HELP! :-)

If Range("C:C").Find(ID.Text, lookat:=xlWhole) IsNotNull Then
Set ErrorMsg = “Duplicate ID. Please create a Unique ID.”
GoTo ErrorEnd
End If

Axwebbrowser, How To Click &lt;a Onclick="javascript:PageFormSubmit(27); ?
I am automating the navigation of a webpage. There are some javascript buttons on the page. It is in frames of course. I found the information in frame 3.

How to I click the javascript buttons programmatically?

I would also like to know how to navigate frame3. Meaning just give it the url and have it go to the right page.
If I just use axwebbrowser1.navigate(txturl.txt) it screws up the frames.

Thanks for any advice.

Why Does Trapping OnClick In Document Stop Click Actions Happening In WebBrowser?
I am developing a VB.NET application with the WebBrowser control. I need to record user events, and play them back later. I have already built a generic document event handler and made that capture onClick events (see below), but the normal action of the onClick is not happening in the WebBrowser itself, e.g. dropping down a SELECT, or setting focus in an INPUT.text.

This is totally doing my head in, any ideas anyone?

Code: Private Sub AxWebBrowser1_DocumentComplete(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent) Handles AxWebBrowser1.DocumentComplete
        Dim domDocument As mshtml.HTMLDocument = DirectCast(AxWebBrowser1.Document, mshtml.HTMLDocument)
        Dim domEvents As mshtml.HTMLDocumentEvents2_Event = DirectCast(domDocument, mshtml.HTMLDocumentEvents2_Event)
        AddHandler domEvents.onclick, AddressOf domEventOnClick
    End Sub

    Private Function domEventOnClick(ByVal e As mshtml.IHTMLEventObj) As Boolean
        Debug.WriteLine("type: " & e.type)
        Debug.WriteLine("srcElement.tagName: " & e.srcElement.tagName)
        Debug.WriteLine(" " &
        Debug.WriteLine("srcElement.innerHTML: " & e.srcElement.innerHTML)
        Debug.WriteLine("srcElement.className: " & e.srcElement.className)
    End Function

Edited by - davidgreenmoor on 9/20/2002 1:06:52 AM

ListView "onclick" For Items --

I want to call a sub when the user clicks on an item in the ListView. How?

Thanks for any help

- Jake

Passing Values From Read Properties Event To Show Event In USER DOCUMENTS
Hi Friends

How can i send a value from Read properties event to show event of the

User document object in Visual Basic 5.0

For example
public test as integer ' Declare it in an general .
Private Sub UserDocument_ReadProperties(PropBag As PropertyBag)

Test = 10

end sub

But value of the Variable test is not available in Show event .
Private Sub UserDocument_Show
msgbox test
end sub

Thanks and Regards

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>

Event Log Collector - For The Event Viewer - To Collect Events Into A Database - How To?
Hi I am perplexed, I feel hopeless, I hope that someone can help me
with a problem. I have Visual Basic .NET

I want to develop an Event Collector. That will collect all events
from the Local computer or maybe 2 computers; (1 local and 1 remote) -

Collecting the Event Viewers Logs but only the system and application
logs and then put them into a Access database as a table, so that I
can run Querys on the events, such as:

Assuming both computers had several Event Id 2003's with Event Source

I want 2 input boxes that I can input the Event Id, and the Source and
then run querys to see what times they occured and on what computers
they occured on.

I want to expand on this concept later by adding more computers and
more tables, and different types of queries, but for right now I just
need to know how to do this small scale
(just for the local computer and maybe one remote computer.)

This will get me started and I think I can figure out the rest.

Please help me get out of this rut. Thanks for any advice or help no
matter what it is I am sure it will help and I can get something out
of it.

Thanks again! ~N.

Enter Event Question And Writing Event Procedure In New Workbook
Hello everybody

I am using the enter event to clear a textbox when enter, (But code is executed only when the textbox is empty)
this works fine but the event is only fired one time, is this the normal behavior for this event?
if yes, any other way to do this?

Private Sub TextBoxNames_Enter()
If TextBoxNames.Value = "" Then
CheckBoxA.Value = 0
 CheckBoxF.Value = 0
 CheckBoxR.Value = 0
 CheckBoxS.Value = 0
 CheckBoxSET.Value = 0
 CheckBoxT.Value = 0
 CheckBoxW.Value = 0
 End If
End Sub

Second question

Is it possible to write events in a new workbook programmatically from vba and if yes,
how to do this?

Thanks a lot


What Event Fires When A Combobox Changes Value?? The Change Event Does Not Work!
I tried

Private Sub cmbNAME_Change

but it never goes off.

Any suggestion??

KeyPress Event And TextBox Change In Same Private Event
First off, thank you for this forum...I'm extrememly new so be kind as I know this is a simple task but I'm stuck off in the weeds.

My goal is as someone enters an IP address octet in a textbox, when they get to either 3 characters entered or press the "." key, it will move them to the next octet textbox. I figured how to do it as a keypress event or by text length but how do I monitor both?

I've tried the following:

Private Sub txtIPentry1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtIPentry1.KeyPress
        If e.KeyChar = Microsoft.VisualBasic.ChrW(46) Or txtIPentry1.Text.Length > 2 Then
            e.Handled = True
        End If
    End Sub

I just don't know how to combine a txtIPentry1_TextChanged and txtIPentry1_KeyPress event into the same set of code.

Thanks for helping the newbie....

How To Have A Tick Event Similar To Worksheet_Change Event
Anyone kind enough to share idea how can I have a tick event or any similar coding in Excel VBA. My problem is, I wanted something like Timer Control running behind my Excel workbook. I wanted to accomplished this without using directly the visual studio. Is it possible to have a timer control on a worksheet?

I discover that the worksheet has an event of Worksheet_Change. but in my needs this is not enough to accomplish what i want. For example: if time is already #11:00 AM# a certain procedure should run. This task is easily done using visula basic studio. Using VB as front end you could easily manipulate the ms-excel with timer control. But in our application, we should only use the ms-excel. I was thinking of creating ADD-ins or module that has the capability of the timer control. but unfortunately, i am lost in doing this.

anyone plz help.

Event Fires When Prior Event Still Running
I've got a treeview with a folder view. When you click on an individual folder it starts to display information about all the items from a 3rd party system in into a listview. When you click a different folder it should then display that folders content. Problem is that when you click the 2nd folder the 1st folder content gets added because that code hasn't ended yet.

The two solutions I've tried so far:

1. Don't allow people to click another folder while the original folder is loading. This isn't acceptable since folder loading can take time and the system can't be unresponsible for that time. For instance if someone accidently clicks a folder they should be able to then click the proper folder.

2. Put two variables in my form. One responsible for saying 'Process is running', and the other 'Stop Processing'. So in my NodeClick Event I had the following code:

If m_BrowserIsLoading Then
m_BrowserCancelLoading = True

Loop Until Not m_BrowserIsLoading
End If

And in my processing code I added this:

If m_BrowserCancelLoading Then
m_BrowserIsLoading = False
Exit Sub
End If

What ends up happening is that the 1st process does stop BUT the m_BrowserIsLoading is never reset in such a way that the 2nd process can read the change and it ends up doing an infinite loop.

Any thoughts? Suggestions? I do have the Desaware Background threading component so I'm considering making a thread that does the adding of the info to the listview but if I don't have to add another reference to my work that'd be nice.



Copyright 2005-08, All rights reserved