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

The UserForm_Initialize Event Doesn't Occur ??

My problem is that the event UserForm_Initialize doesn't occur when
I start this particular UserForm.
Does anyone know why that is the case???
Bye, EE

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
MouseUp Event Doesn't Occur
On my computer, when OPENING a large program that takes huge amount of resources and memory, while releasing the mouse (MouseUp), the MouseUp event doesn't occur.
This doesn't happen always but sometimes which make my application malfunction.
Does this happen to anyone?
Is there a fix to this?

Why "Change" Event Of Combo-box Doesn't Occur When Selection Changed?

The "Change" event of standard combo-box does not occur when you drop down the list and select a different item from the list.

The event occurs only when you type any character if Style property of the combo-box is not equal to "Dropdown List" (2). If this property is equal to "Dropdown List", this event does not occur at any-time.


Or is there any other combo-box that has not this problem?

Where Does Show Event Occur
I have created a homegrown control that uses a passed recordset and I want to populate two list boxes. (Much like help in vb - you can type in a text box and the list box will scroll down showing choices). It is a customer sorted list by name and the record set that is passed is name and number. You type in a name and when you click on a selection it returns the number.

I have this working fairly well but I can't figure out where to populate the list. "Show" is too late. Where does the show event occur so I can populate the lists before. Initialize and Initproperties are too early and show is too late.

I have tried using dblists etc but the must be tied to an adodc and I want to build a list at run time with an sql.

Thanks in advance.

What Event Use When Minimize Form Occur?
I want to do something when minimize form is occur.
How To

Best Regards

Make Resize Event Occur Before Show??
Anyone know how to make the Resize event occur before the Show event in an MDI form?

If you have more than one child, and one is maximized, when you switch to another child, you can see the resize happen.

Can this be avoided?

(Yes, this is the same question I posed earlier written differently!
No one answered the other question!)

MSForms.CommandButton's Click Event Does'nt Occur
I have an MSForms.CommandButton in VB environment. The problem is that when I click it, the OnClick event does'nt occur.
I must set any special property or why does'nt work? Please help me.

With Regards,

Event Doesn't Fire

I'm adding a CommandButton to my startup form at runtime.

set cmd1 = Form1.Controls.Add("VB.CommandButton", cmdnew)

It is displayed correctly. However, the relating event

Sub cmdnew_Click()
End Sub

won't fire. What am I doing wrong? All I could find out is that it's probably related to the control's lifetime. Is there a better way to create controls dynamically? When I use the New Keyword

Dim cmd1 As CommandButton
cmd1 = New CommandButton

I always get an error message.

Thanks for your help.

Form_MouseMove Event Doesn't Trigger
i.e. it does, but VERY far-between.
whats the matter?

WebBrowser FileDownload Event Doesn't Fire matter what combination of properties like Silent/RegisterAsBrowser etc. I use. The IE dialog box pops up, and the event doesn't fire at all. I am trying to make my own download manager, so this isn't very helpful behaviour from Microsoft

Using Appactivate On Mousedown Event Doesn't Work?
I use the Shell API to launch 5 internet Explorer windows. Each window has a different link loaded and the addresses are stored as Variables called IntWindowsSHell(1 to 5)

When I click the first internet explorer window it uses the following mouse event :

Private Sub Browser1_onmousedown()
'MsgBox "Click Detected" (Explained afterwards)
AppActivate IntWindowsSHell(2).
End Sub

Now the trouble is, I look at my taskbasr and see the 5 windows all grouped together. When I click on the first window, the windows in the task bar flash, and when I click them I see window number 2 is indeed flashing. So basically it has activated it, but not brought it to the front of the screen.

If I add the MsgBox back into the code (Shown Above) and then click the IE window, the message box pops up, and then when I click OK the next screen pops up without a problem.

What do I need to do to make this seemless, so that when I click the IE window, the next window appears? I've played with ShowWindow API but that does the same thing, a flashy bar.

Thanks for any help


UserControl Doesn't Receive DragDrop Event...
I've created a UserControl and I need to add dinamically to a form and allow the user to do a drag and drop operation with it. The problem, is that the control doesn't recevie the DragDrop event on itself. Any idea??? Or some related link that explain the implementation of drag and drop for visual editing applications, will be appreciated.

Thanks in advance !!!!!

ComboBox Array - Event Change Doesn't Fire ?

I've a couple of ComboBoxes in a contral array inside my form.

Now, as soon as I double click on the combo box in the object viewer of the form it takes me the the code and let me add something on the event Change.

Looks like this there:

Private Sub cbxArray_Change(Index As Integer)
'I would like to do something
End Sub

The problem is, this is never firing. =(
I tried the same with the Click event and I did not encounter any problem.

So is there something special with the Change Event or am I doing something wrong?

The event fires as soon as Im typing something into the combo box but I don't want typing I just want the selecting from existring items and that should fire change...

2nd Edit:
Okay, the change event doesnt apply because it only fires upon typing changes.
I think I have to stick to click event then.


Why The Timer Event Doesn't Occurs In My Project ! Help Needed

I created a sample project to test whether my mail can be send from VB6 by using Outlook. I am able to recieve the mails, but the timer event did not occurs. I also attached the project. here. Even the DoEvents is used. Kindly can any one reply about it.


Array In Form Load Event Doesn't Work!
I have made a form and put 5 Combo Boxes in there.

In the Form Load event, I populated all those Combo Boxes with figures etc..

After that, I stated some arrays and then when I try to run it, it doesnt work. Message comes up saying "Expected Array".

Here is the code:

Private Sub Form_Load()

'Populate the Runway Combo Box

cboRwy.AddItem "Runway 10"
cboRwy.AddItem "Runway 28"
cboRwy.ListIndex = 0

'Populate the Flap Combo Box

cboFlap.AddItem "Flap 5"
cboFlap.AddItem "Flap 15"
cboFlap.ListIndex = 0

'Populate the Wind Combo Box

For W = -10 To 20
cboWind.AddItem (TW) & " Knots"
Next W

cboWind.ListIndex = 10

'Populate the Temperature Combo Box

For T = -10 To 40
cboTemp.AddItem (T)
Next T
cboTemp.ListIndex = 22

'Populate the QNH Combo Box

For Q = 980 To 1050
cboQnh.AddItem (Q)
Next Q
cboQnh.ListIndex = 30

'Populate the EAI Combo Box

cboEAI.AddItem "Anti Ice ON"
cboEAI.AddItem "Anti Ice OFF"
cboEAI.ListIndex = 0

A = -10
For f = 1 To 5
R10F5Array(0, f) = A
Debug.Print R10F5Array(0, f)
A = A + 5

B = -10
For f = 1 To 11
R10F5Array(f, 0) = B
Debug.Print R10F5Array(f, 0)
B = B + 5

'Populate the internal grid array
'for Rwy 10, Flap 5

R10F5Array(1, 1) = 18460
R10F5Array(1, 2) = 19200
R10F5Array(1, 3) = 19850
R10F5Array(1, 4) = 20320
R10F5Array(1, 5) = 20690

R10F5Array(2, 1) = 18350
R10F5Array(2, 2) = 19110
R10F5Array(2, 3) = 19750
R10F5Array(2, 4) = 20240
R10F5Array(2, 5) = 20630

R10F5Array(3, 1) = 18240
R10F5Array(3, 1) = 19020
R10F5Array(3, 1) = 19670
R10F5Array(3, 1) = 20150
R10F5Array(3, 1) = 20570

R10F5Array(4, 1) = 18120
R10F5Array(4, 1) = 18910
R10F5Array(4, 1) = 19570
R10F5Array(4, 1) = 20050
R10F5Array(4, 1) = 20490


End Sub

Do you know what the problem is?

Why Doesn't Double Click Event Fire For Combo Box?
Why doesn't the double click event fire for the combo box? I assume it is supposed to. Am I missing something? Please help!


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

DocumentComplete Event Doesn't Fire When I Refresh Webbrowser's Document
Webbrowser doesn't fire DocumentComplete event when I refresh page.
Whether I refresh manually or programmatically or page refreshes itself by "location.reload()".
It is probably a bug similar to one that causes DocumentComplete event to be lost when Webbrowser is invisible.
I tried sink document's events directly and it's readystate argument goes till 'interactive', skipping last state - 'complete'...

Is it the common bug and if so what could be the best workaround methods?

Event Doesn't Fire When Processing A Loop? (Catalyst's Socketwrench)
I'm trying to automatically send a list of commands using the telnet client control that is part of Catalyst's Socketwrench toolkit.

I've written a simple program that first connects to a server; i.e. TelnetClient1.Connect

Then I issue a sequence of commands to login to the server and do some "stuff".

It works when I manually push a "Send" button 6 times which issues a "TelnetClient1.Write" for each of the following commands (1 for each of the 6 pushes):
telnet xyz

Each of these "TelnetClient1.Writes" fires the "TelnetClient1_Read()" event which contains the commands:
TelnetClient1.Read TelnetData1
RichTextBox1.Text = TelnetData
thus putting data that the server is spitting out onto the display (RichTextBox1) in my program.

Like I said this works fine when I manually push the button 6 times.

The problem happens when when I create a loop that automatically sends each of the commands, waiting a second in between them. In this case the "TelnetClient1_Read()" event won't fire until my loop is done.

In other words, nothing appears on my display until the end.
It seems as though the event won't happen because I'm doing something else (processing the loop).
Does that make any sense? Is there a better way to do this?
Should I forget about it?
Thanks for any advice.

Syntax Occur
when i press the cancel button a syntax occur it said path/file error
Dim strListItems, a As String
Open CommonDialog1.FileName For Input As #1
While Not EOF(1)
Line Input #1, strListItems
lst.AddItem strListItems
Close #1

Deleting Words That Occur More Than Once
Can somebody please tell me if it would be possible to delete words that occur more than once so that no words will be the same in a word document file? Can you give me some copde samples on how to do it because i cant think of a way to do it. Thanks in advance

Splash Screen Occur Only Once
I have a program that has 3 forms in it.

One of the forms is a Splash Screen but I only want that one to run the first time the program has been run so when the program has been exited and started up again I do not want that Splash screen to show.

How would I go about doing that?

Thanks very much

How To Enable Save Only When Changes Occur
I need to Enable a button with caption save only if any changes occur in the form ,as in MS product ,ask to save if changes occur else no need to save.

How it can be done in a simple way without using Boolean variables and setting it value,

I need a solution for this ,bcaz when i close the form after changes I need to ask confirmation for saving,if no change occur no confirmation is needed

If anyone know the soln plz write Reply

Error Occur When Msbgox Is Remove!
Hi i have this program whereby the user send in an enquiry via SMS then my program will receive the enquiry and go to the database and search and reply back to the user the search results via SMS. Here is my problem: I can keep receving incoming SMS provided i did not remove the msgbox below.........when i try to remove the msgbox an error will occur saying that invalid procedure call or argument! Below is the part where i try to remove the msgbox:

MSComm1.Output = "AT+CNMI=0,1,0,0,0" + vbCr 'Receive incoming SMS

dummy = DoEvents()
If MSComm1.InBufferCount Then
FromModem$ = FromModem$ + MSComm1.Input
If InStr(FromModem$, "OK") Then
MsgBox (FromModem$)--->When i remove this line error will occur

Exit Do
End If
End If


FromModem$ = ""
temp = MSComm1.Input

Below is my whole sending and receiving SMS source code:

Private Sub cmdsearch_Click()

Dim Find As String
Dim myArray() As String
Dim tempArray() As String
Dim tempName As String
Dim count As Integer
Dim blankCount As Integer
Dim i As Integer
Dim j As Integer
Dim pos As Integer
Dim found As Boolean
Dim recordCount As Integer
Dim present() As Boolean
MSComm1.Output = "AT+CNMI=0,1,0,0,0" + vbCr 'Receive incoming SMS

dummy = DoEvents()
If MSComm1.InBufferCount Then
FromModem$ = FromModem$ + MSComm1.Input
If InStr(FromModem$, "OK") Then
Text3.Text = (FromModem$)

Exit Do
End If
End If


FromModem$ = ""
temp = MSComm1.Input

MSComm1.Output = "AT+CMGF=1" + vbCr 'Change to text mode

dummy = DoEvents()
If MSComm1.InBufferCount Then
FromModem$ = FromModem$ + MSComm1.Input

If InStr(FromModem$, "OK") Then

Exit Do

End If

End If


FromModem$ = ""
temp = MSComm1.Input

FromModem$ = ""
temp = MSComm1.Input

MSComm1.Output = "AT+CMGR=1" + vbCr 'Read SMS received

dummy = DoEvents()
If MSComm1.InBufferCount <> 0 Then
FromModem$ = FromModem$ + MSComm1.Input
If InStr(FromModem$, "OK") Then
mobile = FromModem$
p = InStr(mobile, "9")
num = Mid(mobile, p, 8)

Find = FromModem$
Ps = InStr(Find, "+")
Ps1 = Mid(Find, Ps, 6) 'Look out for 2nd "+" and display+CMGR

Pf = InStr(Ps + 1, Find, "+") '+CMGR
Pf1 = Mid(Find, Pf, 5)

message = FromModem$

Ps = InStr(Pf + 1, Find, "+") 'display hp no
Ps1 = Mid(Find, Ps, 11)

Pf = InStr(Ps + 1, Find, "+")
Pf1 = Mid(Find, Pf, 6) 'display +00

Ps = InStr(Pf + 1, Find, Chr(34)) 'Display name to search with OK
Ps1 = Mid(Find, Ps + 1)

Ps1 = Replace(Ps1, "OK", "") 'Remove OK and display only the name to search in the textbox
Ps1 = Replace(Ps1, vbCrLf, "")
Ps1 = Replace(Ps1, vbCr, "")
Text1.Text = (Ps1)

Exit Do

End If

End If


myString = ""

Find = Trim(Text1.Text)
If (Find) = "" Then
MsgBox "No search-name specified. "
Text1.Text = ""
pos = 0
blankCount = 0
found = True

Do While found
pos = InStr(pos + 1, Find, " ", vbTextCompare) 'search for ""

If pos <> 0 Then
blankCount = blankCount + 1
found = False
End If

If blankCount > 0 Then '"" found then split Find into arrays
myArray = Split(Find, " ")
ReDim myArray(1)
myArray(0) = Find
End If

ReDim present(blankCount + 1)

Data1.DatabaseName = "D:Silingdb1.mdb"
Data1.RecordSource = "MYDATA"

If Data1.Recordset.EOF Then
MsgBox "No records found! "

recordCount = 0

Do While Not Data1.Recordset.EOF
tempName = Data1.Recordset![PreferredName]
found = True
count = 0
Do While found
pos = InStr(pos + 1, tempName, " ", vbTextCompare)

If pos <> 0 Then
count = count + 1
found = False
End If

If count > 0 Then
tempArray = Split(tempName, " ")
ReDim tempArray(1)
tempArray(0) = tempName
End If

For i = 0 To blankCount
present(i) = False
Next i

For i = 0 To blankCount
For j = 0 To count
If StrComp(myArray(i), tempArray(j), vbTextCompare) = 0 Then
present(i) = True
End If
Next j
Next i

found = True

For i = 0 To blankCount
If present(i) = False Then
found = False
Exit For
End If
Next i

If found = True Then

recordCount = recordCount + 1 'found record
EmpList.ListItems.Add recordCount, , Str$(recordCount) 'Display Record found into listview"
EmpList.ListItems.Item(recordCount).ListSubItems.Add 1, , Data1.Recordset![PreferredName]
EmpList.ListItems.Item(recordCount).ListSubItems.Add 2, , Data1.Recordset![InternetAdd]
EmpList.ListItems.Item(recordCount).ListSubItems.Add 3, , CStr(Data1.Recordset![PhoneNumber])
myString = myString & "" & Data1.Recordset![PreferredName] & " " & CStr(Data1.Recordset![PhoneNumber]) & " " & Data1.Recordset![InternetAdd]
Text2.Text = (myString)

MSComm1.Output = "AT+CMGD=1,4"

Sleep 100
MSComm1.Output = vbCr
Sleep 100
FromModem$ = ""

dummy = DoEvents()
If MSComm1.InBufferCount Then
FromModem$ = FromModem$ + MSComm1.Input
If InStr(FromModem$, "OK") Then

Exit Do
End If
End If


MSComm1.Output = "AT+CMGS=" + num
Sleep 1000
MSComm1.Output = vbCr
Sleep 1000

MSComm1.Output = myString + Chr(26) 'Sent record found via SMS

dummy = DoEvents()
If MSComm1.InBufferCount Then
FromModem$ = FromModem$ + MSComm1.Input
If InStr(FromModem$, "OK") Then

Exit Do
End If
End If


End If


If recordCount = 0 Then 'Record Not Found

Text2.Text = "Sorry! Record Does Not Exist!"
MsgBox " Sorry! Record Does Not Exist! "

MSComm1.Output = "AT+CMGD=1,4" 'Delete SMS received

Sleep 100
MSComm1.Output = vbCr
Sleep 100
FromModem$ = ""

dummy = DoEvents()
If MSComm1.InBufferCount Then
FromModem$ = FromModem$ + MSComm1.Input
If InStr(FromModem$, "OK") Then

Exit Do
End If
End If


MSComm1.Output = "AT+CMGS=" + num
Sleep 1000
MSComm1.Output = vbCr
Sleep 1000

MSComm1.Output = "Sorry! Record Does Not Exist!" + Chr(26) 'Reply back to the user 'Sent record found via SMS

dummy = DoEvents()
If MSComm1.InBufferCount Then
FromModem$ = FromModem$ + MSComm1.Input
If InStr(FromModem$, "OK") Then

Exit Do
End If
End If


End If

End If

End If

End Sub

Anyone know please spare some time to help me this is super urgent! Thank greatly........
Your help is greatly appreciated!

Combobox Doesn't Respond To "change" Event
I have comboboxes where you select from the list to search a database (this is so that the search strings are always of the same format) If you want to search for a Grammar function such as "Past Perfect" you select it rather than miss the hit if you type "Past perfect function" etc - I hope that's clear; anyway, if you do not find what you want, you can select an entry at the top of the list called "Add new ..." and this then allows you to add to the list so it is available next time. VB6 does not activate the "change" event when you select from the drop-down list. Is there any way to recognise this, or do I have to rely on "lostfocus", clearly, it would be very much easier if I didn't..
I would appreciate any comments you have thanks

What Makes Run-time Error No 3265 Occur
why does the run time error given below:

run time error '3265':
item cannot be found in the collectiion corresponding to the requested name or ordinal.

i've been receiving this since i want to display the data in an acess table by entering one of its field. i'm using adodc connection and MS Jet 4.0 provider

ADO Data Control : Catching Errors When They Occur
Hi there! I've an ADO data control on my form and at design time, I connected this control to a database file which I created.

The thing is : how do I catch run-time errors that the ADO data control fires when it encounters an error?
Is it even possible?

If so, how do u do it?

I've tried coding in the Error event of the ADO Data control, and even using On Error Gotos, but none of these are triggered!!!!

Please and thanks a lot!

(u see, in my case, I wanna check whether the value of the primary key in current record already exists in the database, and duplicated primary keys always gives an I wanna catch the error myself when the user moves on to another record etc.......)

Is It Possible That The Listview Don't Refresh All The List When A Change Occur?

when the value of an item in a listview change, all the list is refresh.Is it possible to refresh only the line corresponding of the item which change?
Thank you for your responses
Best regards

When Install VB Application To Other Computer, It Occur Erroc
i had completely finish the VB application, so, i want to use PACK to pack it up, then it will contain the setup installor......
but when i install to other computer, it copy the dll files, but the last one "msvbvm60.dll" have error occur.So can anyone tell me what's wrong on my program?!?!!?
Thanks in advance!!

Cire from HK
Eric @(^_^)@

Error Occur When Unzip File Using Info-ZIP_Unzip_DLL
I get this error: "File not found: vbuzip10.dll" when run the code below:

m_cUnzip.ZipFile = sFIle
m_cUnzip.UnzipFolder = "D: ry"

I've download the vbunzip10.dll, and save it in the same folder of the program. I tried to register the dll but I got error again. Please refer to the attach jpg.

Anyone know how?

When Programs Compiled In VB 6.0 (Automation Error, ILLEGAL OPERATION Occur)
error code : -2147417848
error description : Automation Error

We are using ADO(DATA ENVIRONMENT) and SQL SERVER 7.0 as the back end. An error occurs when saving the data(when creating new record only).This happens only when the program is in excutable(.exe) while if you are in VB 6.0 Environment the Programs are ok(no BUGS).

Do you know any Microsoft patch for this type of problem with the compiler?

Checking Language Doesn't Work. Right Code But It Doesn't Like Me ;-( HELP
Hello together,

I have allready found the Code that I need for my tool, but it doesn't work.


Option Explicit
Const MODUL = "ClassLocateSettings"

Private Declare Function GetLocaleInfo Lib "kernel32" Alias "GetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String, ByVal cchData As Long) As Long

Private Const LOCALE_USER_DEFAULT = &H400

Private Const LOCALE_ILANGUAGE = &H1 ' language id
Private Const LOCALE_SLANGUAGE = &H2 ' localized name of language
Private Const LOCALE_SENGLANGUAGE = &H1001 ' English name of language
Private Const LOCALE_SABBREVLANGNAME = &H3 ' abbreviated language name
Private Const LOCALE_SNATIVELANGNAME = &H4 ' native name of language
Private Const LOCALE_ICOUNTRY = &H5 ' country code
Private Const LOCALE_SCOUNTRY = &H6 ' localized name of country
Private Const LOCALE_SENGCOUNTRY = &H1002 ' English name of country
Private Const LOCALE_SABBREVCTRYNAME = &H7 ' abbreviated country name
Private Const LOCALE_SNATIVECTRYNAME = &H8 ' native name of country
Private Const LOCALE_IDEFAULTLANGUAGE = &H9 ' default language id
Private Const LOCALE_IDEFAULTCOUNTRY = &HA ' default country code
Private Const LOCALE_IDEFAULTCODEPAGE = &HB ' default code page
When I debug my Code in the Project:


Private Sub Form_Load()

Dim LocaleSettings As ClassLocaleSettings

LOCALE_ILANGUAGE = &H1 ' language id
LOCALE_SLANGUAGE = &H2 ' localized name of language
LOCALE_SENGLANGUAGE = &H1001 ' English name of language
LOCALE_SABBREVLANGNAME = &H3 ' abbreviated language name
LOCALE_SNATIVELANGNAME = &H4 ' native name of language
Then LOCALE_ILANGUAGE = &H1 gets every time the value 1 and SLANGUAGE the value 2 and SENGLANGUAGE the value 4097.
It isn't interesting, which country settings I have choose. Why doesn't work it?!
What must I do?


An Error Occur During "Package And Deployment Wizard" Loading
When i load "Package and Deployment Wizard", it works fine. But at the almost end an error occur:" 'C:.....msftqws.pdw$(DLLSelfRegisterEx)' could not be registed because it was not found" then the wizard delete everything it just setuped.

I wonder if i need to change something in Autoexec.bat???

Thanks any way.


Excel VBA Loop Execution Stops When Excel Events Occur

I have a perpetual loop which is simply incrementing the value in the top left cell in an Excel worksheet. The loop is called on a button press.

In the loop is 'DoEvents' since I eventually want to allow the user to input data so I can use it as it is entered into the worksheet.

Private Sub CommandButton1_Click()
Worksheets("Sheet1").Cells(1, 1).Value = Worksheets("Sheet1").Cells(1, 1).Value + 1
Loop Until False
End Sub
My problem is that as soon as any data is entered into any worksheet, the loop just terminates. I can't see where execution goes using the debugger, it just seems to stop.

Oddly, if I remove the line which increments the cell value and use the debugger to pause execution periodically, it seems as if the loop does not terminate when entering values into the worksheet.

I'm truly confused. I had assumed that events in VBA were similar to interrupts in an embedded system and would 'pop the stack' when they ended and continue execution where they left off. This code is so simple it's hard to see where it could be going wrong.

Any help appreciated.


Edit by Moderator:
Please post Excel questions, in the Excel forum.

Please use the [vb][/vb] tags when you post your code. Edit or reply to this post to see how.

Thank you.

SendInput... Doesn&#039;t Work? Keybd_event... Doesn&#039;t&#039;t Work In Win2K
I am trying to doo a shift-insert (paste) to a richtextbox.
My code for the keybd_event works fine in Win NT and Win 98 but doesn't work in Win2K even though it says it is supported. Here is my code for SendInput which looks good to me but doesn't work?!?

Dim inputevents(0 To 3) As INPUT_TYPE ' holds information about each event
Dim keyevent As KEYBDINPUT ' temporarily hold keyboard input info
Dim mouseevent As MOUSEINPUT ' temporarily hold mouse input info
Dim ret As Long

' Load the information needed to imitate pressing the shift key.
With keyevent
.wVk = VK_SHIFT ' the shift key
.wScan = 0 ' not needed
.dwFlags = 0 ' press the key down
.time = 0 ' use the default
.dwExtraInfo = 0 ' not needed
End With
' Copy the structure into the input array's buffer.
inputevents(0).dwType = INPUT_KEYBOARD
CopyMemory inputevents(0).xi(0), keyevent, Len(keyevent)

' Load the information needed to imitate pressing the insert key.
With keyevent
.wVk = VK_INSERT ' the insert key
.wScan = 0 ' not needed
.dwFlags = 0 ' press the key down
.time = 0 ' use the default
.dwExtraInfo = 0 ' not needed
End With
' Copy the structure into the input array's buffer.
inputevents(0).dwType = INPUT_KEYBOARD
CopyMemory inputevents(0).xi(0), keyevent, Len(keyevent)

' Do the same as above, but for releasing the insert key.
With keyevent
.wVk = VK_INSERT ' the insert key
.wScan = 0 ' not needed
.dwFlags = KEYEVENTF_KEYUP ' release the key
.time = 0 ' use the default
.dwExtraInfo = 0 ' not needed
End With
inputevents(1).dwType = INPUT_KEYBOARD
CopyMemory inputevents(1).xi(0), keyevent, Len(keyevent)

' Do the same as above, but for releasing the shift key.
With keyevent
.wVk = VK_SHIFT ' the shift key
.wScan = 0 ' not needed
.dwFlags = KEYEVENTF_KEYUP ' release the key
.time = 0 ' use the default
.dwExtraInfo = 0 ' not needed
End With
inputevents(1).dwType = INPUT_KEYBOARD
CopyMemory inputevents(1).xi(0), keyevent, Len(keyevent)

' Now that all the information for the four input events has been placed
' into the array, finally send it into the input stream.

ret = SendInput(4, inputevents(0), Len(inputevents(0)))

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.



Public Event In Form Deactivate Event
How do you make a dynamic array created in the Form Deactivate Event able to be “public” or used in other events such as Form resize event.

Is there another way other than storing the array in a public sub?


Does The MSFlexGrid Has Rowloaded Event Or Any Event Work Like That?
I 'd like to change date to my local date when it's show in MSFlexGrid.If i use DBGrid i can use Rowload event but MSFlexGrid doesn't have this event.Is there event of MSFlexGrid work like this Property.

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

RaiseEvent: How Can I Place An Event In The Event Queue?
I have been struggling with a problem for a few days now but I think I have a solution, but need someone to help me out on how to actually do it.

I need to do some calculations which are based on the dimensionslocations of certain controls on my Form. These calculations need to be performed when the Form window is restored from a minimized state. Thing is, in the Form1_Resize event, I can not perform these calculations since the dimensions of the objects are not yet fully restored yet.

Anyway, I have a checkbox object (Checkbox1) which has code associated with it's Click event to perform these calculations for me when the object is "checked". So, a real easy solution to my problem would be to allow the Form1_Resize event to complete fully (as normal) but have a "Checkbox1_Click" event in the event queue which will get processed next "after" the Form1_Resize event procedure has been processed completely.

Inside my Form1_Resize event, I can easily determine when the window is transitioning from a minimized state back to the "normal" window state. As a result, I placed the following code in the Form1_Resize event which will only get executed when this type of window transition occurs ..... but it does not work:

Code:Private Sub Form1_Resize()

   Debug.Print "Form1_Resize procedure is entered"

   If (prevWindowState = "vbMinimized") And (curWindowState = "vbNormal") Then
      RaiseEvent Checkbox1_Click

      Debug.Print "RaiseEvent Checkbox1_Click code is processed"
   End If

   Debug.Print "Form1_Resize procedure exits"

End Sub

Public Sub Checkbox1_Click()

   Debug,Print "Checkbox1_Click procedure is entered"

   Call PerformCalculations

   Debug.Print "Checkbox1_Click procedure exits"

End Sub

It seems the Checkbox1_Click processing is executed immediately (ie: before the Form1_Resize event procedure exits). I validated the order of execution by using some Debug.Print statements. I saw the following order of events:

1) Form1_Resize procedure is entered
2) RaiseEvent Checkbox1_Click code is processed
3) Checkbox1_Click procedure is entered
4) Checkbox1_Click procedure exits
5) Form1_Resize procedure exits

I would like the order of execution to be the following:

1) Form1_Resize procedure is entered
2) RaiseEvent Checkbox1_Click code is processed
3) Form1_Resize procedure exits
4) Checkbox1_Click procedure is entered
5) Checkbox1_Click procedure exits

How can I place a Checkbox_Click event in the queue and have it get processed "after" the Form1_Resize event procedure completes it's processing?

Edited by - uncletr on 10/16/2004 1:00:19 PM

How To Call An Event Function Inside Event
Dear Gurus,

I am using a .DLL File which creates an Event. We have to define a Function for that Event. Whenever that Specified Event Occur it calls this function. Now I need is I have to call Function (Which is source for this event) Inside this function. While calling this function it displays error message as "Call cannot allowed inside this function"

Let know if u need some more information

Triggering Event While Another Event Is Processing
I have an event called winsock1_DataArrival(). If this event is triggered while the previous event didn't finish processing yet, what happens to this new event? Does it get process or is skipped? Thanks.

Copyright © 2005-08, All rights reserved