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




RaiseEvent - It Looks Right... Apparently I'm Missing Something...


All that I am trying to do is raise an event from a class module, and have that event fire on a child form of my mdi app...

In the Class Module
Code:

Public Event MyEvent()

Public Sub Dosomething()
RaiseEvent MyEvent()
End Sub

 

In a Child form
Code:

Public WithEvents mClass as ClassModule

Private Sub Command1_Click(Index As Integer)
mClass.Dosomething
End Sub

Private Sub mClass_MyEvent()
MsgBox "Event Fired"
End Sub



Not having any luck, is there something that i missed as far as having an event fire on a form?

the subroutine in the class runs, no error on the RaiseEvent function, but... the event never fires.

thanks in advance for any suggestions.



Edited by - barke_n on 3/1/2004 9:32:12 PM




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
DOM && XML - Something Which Can't Be Solved... Apparently!
Hi Peeps.

Is there ANY way I can get a DOM script in VB to get XML data from an internal IP address or DNS?

My current DOM script works perfectly with sites on the web, but I simply cannot find any script or changes to the current script to make it resolve both internal and external XML files.

Script:

VB Code:
Dim xDoc As MSXML.DOMDocumentDim objPlugIn As Object   Dim strResponse As String   Dim Indentity As StringSet xDoc = New MSXML.DOMDocumentxDoc.async = Falsenewticketinqueue = FalseIf xDoc.Load(<ADDRESS HERE>) Then   ' The document loaded successfully.   ' Now do something intersting.   DisplayNode xDoc.childNodes, 0   error = False


Can anyone help?

Ta.

AOL IM Add-in Apparently Does Not Exist, How About...
Is it possible to add into a vb app the ability to send a file through AOL's IM Network??

Let me explain more..

I have an AOL IM account.. I can send (FTP) files to other AOL IM users using their "Send A File" tool.. I would like to add a tool to my VB app to use the functionality.. Ofcourse I realize that I would have to log in and so on.. But is it possible??

Thanks for the help,
Rudy

VBA And Lotus (v 6.5.1, Apparently Domino)
amazingly (after much time, research, internal screaming and bad thoughts about IBM) i have managed to code (in VBA 6) a solution to the seemingly simple task of creating a formatted message in lotus. below are a few things i have not been able to figure out how to code (and may be impossible for all i know)...is there any way to...

(1) ...set a font in the message (memo) body other than the lotus default fonts ("FONT_COURIER", etc)? as only font property i can find is NOTESFONT with limited allowed settings.

(2) ...access and append a stored signature - not the digital kind, but the HTML kind? (please do not mention "PassThruHTML")

(3) ...just simply PASTE (a formatted selection from Excel of Word) into a message body?

ANY help whatsoever, even in the negative ("No") is greatly appreciated. Thanks.

VB Uses Unicode? Apparently, NOT [SOLVED]
Hi everybody. I got a question regarding sending a string from VB to C++. VB and COM were supposed to be using Unicode right? Well, I just sent a string like this, and in C++ it gets as normal char, not wide char.


VB Code:
Public Declare Sub SomeDLLFunction Lib ".VCDLL.dll" (ByVal sString As String)SomeDLLFunction("test")


IN C++ when I try to display that string, the "test", as a wide char, it only displays 2 characters as squares (it shows that it doesn't know them). Also, if I do wcslen(TheValueFromVB) it shows only 2. But if I do strlen(LPCSTR(TheValueFromVB)), it shows correctly, 4. So it means that VB actually sends a normal single byte string!




Added green "resolved" checkmark - Hack

DAO 3.6 Apparently Ships With Access2000
Ok if it ships with Access 2000, how come it doesn't appear in my project references list. Do l have to manually register it or something strange?????

Registry Path~I Still Need Help Apparently
Hey everyone. I checked out this link Registry FAQ and am having trouble correlating it to what I want to do, though I am sure the information is in there.

What I want to do is simply check whether or not this path is present: HKEY_LOCAL_MACHINESoftwareDigitalPersonaand act on whether or not it is there. (ie: if it is then launch formA, if it is NOT then launch formB).

What is the easiest, simplest, most understandable way to do this? Its been a long week and I've offically declared it a blonde day (I can do that, I'm blonde ) help me..........

Thank you in advance!

~Elizabeth~

"A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila "


Edited by - Aurian on 1/16/2004 12:49:20 PM

Excel File 'write-only'....apparently
hi wen i use a common dialog to open an excel file, i get error '394' - property is write-only. how do i make it readable? heres my code:


Dim xl As Excel.Application


'Set xl = CreateObject(CommonDialog1.ShowOpen)
CommonDialog1.ShowOpen

Set xl = Workbooks.Open(CommonDialog1)
'CommonDialog1.ShowOpen
'CommonDialog1
'xl.Workbooks.Open (CommonDialog1)

i have no other instances of excel open at the time, so its not that
please help :'(

and sorry for the comments - its just there to show you what i have already tried

thanks lots

Squiddles

My File Doesn't Exist.. Apparently
This is what i have:

Open App.Path & "allinfo.iin" For Input As #1

But it says file does not exist. I've tried it with the as a / and without the thing altogether. I'm sure the file exists though, what could be going wrong?

Winsock Problem [apparently To Difficult-given Up]
While trying to connect to a HTTPS site :

"Your browser sent a request that this server could not
understand. Reason: You're speaking plain HTTP to an SSL-
enabled server port. Instead use the HTTPS scheme to access
this URL, please."

Here's what I use to connect to a ordinary HTTP site:

VB Code:
strHttpRequest = "POST /index.html HTTP/1.1" & vbCrLf    strHttpRequest = strHttpRequest & "Host: " & m_strRemoteHost & vbCrLf    strHttpRequest = strHttpRequest & "Connection: Keep-Alive" & vbCrLf    strHttpRequest = strHttpRequest & "User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Win32)" & vbCrLf    strHttpRequest = strHttpRequest & "Content-type: application/x-www-form-urlencoded" & vbCrLf    strHttpRequest = strHttpRequest & vbCrLf    Winsock1.SendData strHttpRequest


Well, the question is, what does the HTTPS scheme look like?
Anyone who has a clue?

Apparently 1.3 Doesn't Equal 1.3!!! URGENT
Hey guys

I am officially confused as hell!!! I need some help!!!

This is a function that I'm using to set the version of a form being created to 0.1 higher than the maximum existing form version. The field Form_Version is sitting in a SQL DB and is of type decimal and it holds one decimal place.

Code:
Private Function GetNewVersion() As Single
Dim sngMax_Id As Single
Dim sngFrm_Ver As Single

    With rsForm_
        .MoveFirst
        
        While Not .EOF
        
            sngFrm_Ver = !Form_Version
            
            If sngFrm_Ver >= sngMax_Id Then sngMax_Id = sngFrm_Ver + 0.1
            
            .MoveNext
        Wend
        
    End With
    
    GetNewVersion = sngMax_Id
    
End Function


What actually happens is that everything works fine until it gets to the last record(unless there are less than 3 records), then after that, it doesn't recognise that sngFrm_Ver = sngMax_Id, even though they are equal.

does anyone know why this could be happening? This is really killing me!!!!!

Sweet As!

Gareth
_________________________________________________________

To the optimist, the glass is half full.
To the pessimist, the glass is half empty.
To the IT guy, the glass is twice as big as it needs to be.

Apparently My Original Plan Wont Work &gt;.&gt;
Well I guess it turns out using Environ("AppData") wont work due to the fact that the user can selet to save files elsewhere on the computer. Is there a way to search for a file and extract the directory it is in?

lets say something like this:
search for: VisualPront.exe
and if the file was here: c:Program FilesProntVisualPront.exe
it would return: c:Program FilesPront

hope this is possible and not too hard to do...

UPDATE PROBLEM - Duplicate Field Apparently (but It's Not!)
Hi there,
I have an Update problem between 2 tables which I have spent around 72 hours trying to fix, but unfortunately I really need some help, or else need to move on.


I have two buttons on a form, one that Adds a new record, the other that Saves the new record.

I can (sort of) Add one new record and Save it;
I say sort of, because it adds the new record and saves it in the database to the appropriate fields and tables
(I have checked the fields and tables and I can see that it is there)

but when I press ANY button whatsoever after that (eg. try to add another, or even press back, forwards etc.), I get a message saying:

"The additions or changes you have made to the database were unsuccessful as they would create duplicate values in the primary key or relationship etc." <--------- but from what I can see it clearly doesnt create any duplicate values at all


Please take a look at my code and let me know if I am missing something:

By the way, this is using ADO.

The first button: Add
[This opens a new/blank record so the user can add details]


Code:
Private Sub cmdAdd_Click()


Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseServer
db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:ProgramDB.mdb;"


With adoPrimaryRS
If Not (.BOF And .EOF) Then
myBookMark = .Bookmark
.MoveLast
End If
.AddNew
txtCurrent.Text = "* New Record"
txtStatus.ForeColor = &H80FF& 'Change text colour to orange to indicate new record
txtStatus.Text = "Adding New Record..."
mbAddNewFlag = True
End With


Dim sqlQuery As String

Dim sFourDigitQueryID As String
Dim queryRecordCount As String


queryRecordCount = CStr(adoPrimaryRS.RecordCount) + 1

sFourDigitUserID = "QRY" & CStr(Format(queryRecordCount, "0000"))

txtQueryID.Text = sFourDigitUserID



Insert into QUERY(QueryID) values('QRY" & txtQueryID.Text & "')", db, adOpenStatic, adLockOptimistic


End Sub


And the code for the Save button...
[This Saves the current details that have been entered into the text boxes]



Code:
Private Sub cmdSave_Click()


Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseServer
db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:ProgramDB.mdb;"


Set queryRS = New Recordset
queryRS.Open "Select * From Query", db, adOpenStatic, adLockOptimistic

Set customerRs = New Recordset
customerRs.Open "Select QueryID From Customer", db, adOpenStatic, adLockOptimistic

Dim sqlQuery As String

Dim customerQuery As String

queryRS.MoveLast
sqlQuery = "Insert into QUERY(QueryID,QueryDescription,QueryKeywords) values('" & txtQueryID.Text & "', '" & txtQueryDescription.Text & "', '" & txtQueryKeywords.Text & "')"
queryRS.Close 'has to be closed before can be re-opened below
queryRS.Open sqlQuery, db, adOpenStatic, adLockOptimistic



txtStatus.ForeColor = &HFF0000 'Change text colour to blue to indicate okay
txtStatus.Text = "Save Successful"


mbEditFlag = False
mbAddNewFlag = False
mbDataChanged = False

Exit Sub


queryRS.UpdateBatch 'adAffectAll

txtStatus.ForeColor = &HFF0000 'Change text colour to blue to indicate okay
txtStatus.Text = "Save Successful"

adoPrimaryRS.UpdateBatch adAffectAll



End Sub

Anyone see anyone missing or can see where the problem is?

UPDATE PROBLEM - Duplicate Field Apparently (but It's Not!)
Hi there,
I have an Update problem between 2 tables which I have spent around 72 hours trying to fix, but unfortunately I really need some help, or else need to move on.


I have two buttons on a form, one that Adds a new record, the other that Saves the new record.

I can (sort of) Add one new record and Save it;
I say sort of, because it adds the new record and saves it in the database to the appropriate fields and tables
(I have checked the fields and tables and I can see that it is there)

but when I press ANY button whatsoever after that (eg. try to add another, or even press back, forwards etc.), I get a message saying:

"The additions or changes you have made to the database were unsuccessful as they would create duplicate values in the primary key or relationship etc." <--------- but from what I can see it clearly doesnt create any duplicate values at all


Please take a look at my code and let me know if I am missing something:

By the way, this is using ADO.

The first button: Add
[This opens a new/blank record so the user can add details]

Code:
Private Sub cmdAdd_Click()


Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseServer
db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:ProgramDB.mdb;"
 

  With adoPrimaryRS
    If Not (.BOF And .EOF) Then
      myBookMark = .Bookmark
    .MoveLast
    End If
    .AddNew
   txtCurrent.Text = "* New Record"
   txtStatus.ForeColor = &H80FF& 'Change text colour to orange to indicate new record
   txtStatus.Text = "Adding New Record..."
   mbAddNewFlag = True
  End With
  
   
Dim sqlQuery As String

Dim sFourDigitQueryID As String
Dim queryRecordCount As String


queryRecordCount = CStr(adoPrimaryRS.RecordCount) + 1

sFourDigitUserID = "QRY" & CStr(Format(queryRecordCount, "0000"))

txtQueryID.Text = sFourDigitUserID
  


Insert into QUERY(QueryID) values('QRY" & txtQueryID.Text & "')", db, adOpenStatic, adLockOptimistic


End Sub




And the code for the Save button...
[This Saves the current details that have been entered into the text boxes]


Code:
Private Sub cmdSave_Click()


Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseServer
db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:ProgramDB.mdb;"
   

Set queryRS = New Recordset
queryRS.Open "Select * From Query", db, adOpenStatic, adLockOptimistic
  
Set customerRs = New Recordset
customerRs.Open "Select QueryID From Customer", db, adOpenStatic, adLockOptimistic
  
Dim sqlQuery As String
  
Dim customerQuery As String

queryRS.MoveLast
sqlQuery = "Insert into QUERY(QueryID,QueryDescription,QueryKeywords) values('" & txtQueryID.Text & "', '" & txtQueryDescription.Text & "', '" & txtQueryKeywords.Text & "')"
queryRS.Close 'has to be closed before can be re-opened below
queryRS.Open sqlQuery, db, adOpenStatic, adLockOptimistic

  

  txtStatus.ForeColor = &HFF0000 'Change text colour to blue to indicate okay
  txtStatus.Text = "Save Successful"


  mbEditFlag = False
  mbAddNewFlag = False
  mbDataChanged = False

  Exit Sub


   queryRS.UpdateBatch 'adAffectAll

  txtStatus.ForeColor = &HFF0000 'Change text colour to blue to indicate okay
  txtStatus.Text = "Save Successful"

 adoPrimaryRS.UpdateBatch adAffectAll
    


End Sub



Anyone see anyone missing or can see where the problem is?

Vsflexgrid Hangs After Fetching 1000 Records Apparently
I have a recordset on a table, and it has round about 7000 or more record. If i want to display records more than 1000 or so, appln runs so slowly that apparently it goes to Hang position. Actually my objective is to show the data to the user and accordingly they took the data in Excel.


Pls. help me out. Here the function is written in such a way so that if i pass any query through it, automatically it will displayed in the grid, and i had not to do any change in the program.


Below are the codes i use:
Public Sub vsflex_fill_all(VSFlex1 As VSFlexGrid, ByRef pQry1 As String, ByRef pqry2 As String)
Dim row, col, MaxCol As Integer
Dim StrQry As String
Dim InvType As String

row = 1
col = 1

VSFlex1.Rows = 1
VSFlex1.Cols = 2

If rs.State = 1 Then
rs.Close
End If
MsgBox pQry1
rs.Open pQry1, cn, 1, 2


If rs.MaxRecords > 0 Then
rs.MoveFirst
End If

' initialize header
For col = 0 To rs.Fields.Count - 1
VSFlex1.Cols = col + 2
VSFlex1.TextMatrix(0, col + 1) = rs.Fields(col).Name
VSFlex1.AutoSize col
Next

While rs.EOF = False
VSFlex1.Rows = row + 1
For col = 0 To rs.Fields.Count - 1
If Not IsNull(rs.Fields(col)) Then
VSFlex1.TextMatrix(row, col + 1) = rs.Fields(col)
Else
VSFlex1.TextMatrix(row, col + 1) = " "
End If
VSFlex1.AutoSize col
Next
VSFlex1.Refresh
Main.StatBar.Panels(3).Text = "Fetched row no is " & row
Main.StatBar.Panels(3).AutoSize = sbrContents
Main.StatBar.Refresh

rs.MoveNext
row = row + 1
Wend
VSFlex1.AutoSize col

VSFlex1.FixedCols = 1
VSFlex1.FixedRows = 1

With VSFlex1
' sorting
' .Select 1, 0, 1, .Cols - 1
.Sort = flexSortGenericAscending
.ColHidden(0) = False
.FrozenCols = 1
' For row = 1 To .Rows
' .MergeCol(row) = True
' Next row

' insert subtotals
.OutlineCol = 0
.OutlineBar = flexOutlineBarComplete
.SubtotalPosition = flexSTAbove
.Subtotal flexSTClear
' .Subtotal flexSTSum, -1, 17, "#,###.00", 1, vbWhite, True
' .Subtotal flexSTSum, 2, 17, "#,###.00", &HFFFFC0, , False
' .Subtotal flexSTSum, 3, 17, "#,###.00", &HFFFFC0, , False
' .Subtotal flexSTSum, 6, 17, "#,###.00", &HFFFFC0, , False
' .Subtotal flexSTSum, 8, 17, "#,###.00", &HFFFFC0, , False
.ExplorerBar = flexExSortShowAndMove

End With
Main.ProgrBar.Visible = False
End Sub

RaiseEvent
I want to raise an event from a class module. Would I need to put the event in a global module or on a form? I know that in user controls you set the event by saying...

ControlName_EventName Then the Control Name shows up in the right hand box at the top of the screen and the EventName in the left hand (procedure) box.

When I say...
ClassName_EventName it all shows up in the left hand (procedure) box will it still be recognized when the event is raised?

RaiseEvent
Seasons Greetings,

The current project that I am working on requires some of the forms to be subclassed. I have a standard module which contains the Window Procedure function, that handles the messages.

I also have two class modules A and B. Class module A is used to create and later reference new class module B objects. Each item in collection A contains an Object B and a reference to the object.

My problem is; when I receive a message that I am interested in, I would like to raise an event, and handle this event in a form module.

I have tried to keep it short and to the point but I can elaborate if needed.

I look forward to any responses!!

RaiseEvent
I subclassed a control in my usercontrol. Now how do I raise an event thats in the usercontrol module from a difrent module?

Thanx in advance!

RaiseEvent HELP
Im receiving a error message when load the program.
"Event not found", why?


Code:
Private Sub winsocks_DataArrival(Index As Integer, ByVal bytesTotal As Long)

Dim tmp As String
Dim rs_apert As New ADODB.Recordset
Dim rs_prate As New ADODB.Recordset

'On Error GoTo DataArrivalError
'
' Save the amount of data received.
m_lngBytesReceived = m_lngBytesReceived + bytesTotal
'
' Grab the data from the specified Winsock object, and pass it to the parent.
Call winsocks(Index).GetData(tmp)
RaiseEvent DataArrival(Index, tmp)

End Sub

RaiseEvent
I have an ActiveX EXE with a class module in which raises events.
The RaiseEvent Woof() gets fired, but my project, which references this class module does not get the event.
I declare the object with WITHEVENTS and my IDE can see the different events which my class can raise, but when the RAISEEVENT line fires the event is NOT picked up by by client side app....Anyone come across this before???

RaiseEvent
I have a problem. I'm making an ActiveX DLL with a Class. In its code I have this:
VB Code:
Private WithEvents TI As cTrayIcon Public Event pctLeftClick()Public Event pctRightClick()Public Event pctMove()Public Event pctDoubleClick()
TI is a class of my DLL. And I would like to raise the event of the TI to my Standard EXE project.

However, even though the RaiseEvent PictureRightClick gets executed, this code
VB Code:
Private Sub TI_PictureRightClick()    RaiseEvent pctRightClickEnd Sub
never gets executed so my EXE doesn't get the event...

Any ideas?

DLL RaiseEvent
Is it possible to generate an Event from within a DLL? If so can it only be done from a class? And how do I catch it from the calling project? Or is it just easier to use an OCX?

RaiseEvent Help , Please.
Hi,

I have an Activex.exe project I'm working on.

In this project I also have a form , containing most of the code.

This ActiveX.exe project at the end will be an Exe file , called from a standard project.

The problem I have is that I want to be able to RaiseEvent from my Form and not from the Class , I know it is possible , How ?

What I did (but didn't work) :

Code in Form1 :

Public Event Hello()

private sub command1_click()

RaiseEvent Hello

End sub


Code in Class1 :

Public Event Hello()

Dim withevents ObjClass as Form1

Private sub Class_Initialize()

set Objclass = new Form1

End sub

Now I have an object in the Class1 called ObjClass
This object has an Event called Hello :

private sub ObjClass_Hello()

msgbox "Hello"

End sub

In the above code the Event not rise , also I don't have any Errors!

I think it's a bug in Visual Basic ?

Help!!!

Thanks in advance , Moyalt.

RaiseEvent
somebody can explain what exacty make RaiseEvent

thanks

RaiseEvent From Other DLL
Hello!
If I call a dll from my GUI, and that dll calls another dll and that dll makes a raiseevent, how do I get the event up to my GUI??

I reference to the second dll, and I can also see the public events but somehow they are not triggered...

There's is no problem from the first dll to my GUI :O)



TIA

Janus

RaiseEvent
Forgive me if this has been asked many time but I have searched the board and not found a relevent example.

I am new to RaiseEvent and wondered if anyone can give me an example, all I want to do is have 2 forms Form1 has a listbox, Form2 has a textbox and command button. I want to raise an event to put whatever is in the text box into the listbox on Form1 when clicking the command button.

Thank you

RaiseEvent Not Firing
I have a program which spawns a child form. The child form creates an object:

(Declares portion of Child module)
Public WithEvents Server1 As CINTComSvr.clsNETSvr

In the child Form.Load sub:
Set Server1 = New CINTComSvr.clsNETSvr

The program uses an acitiveX exe as the "Server".

The Server code (activeX) declares several Events with standard argument variables (Strings and Longs, no optionals or other surprises). The child form contains all the methods for these events.

For clarity, I'll refer to the Child form in the main program as A and the activeX program as B.

The problem:
I can click on a button in A, to call a function in B, which in turn raises an event in A. That works just fine. However, if program B raises an event on it's own, A does not get it. The method in program A never fires.

I know I am missing some principal issue here... Any help regarding general rules would be greatly appreciated.

I'd post more code, but there is just too much to post. I'm hoping that this can be resolved through theory of use. (proper usage anyway)

Thank You

Q. Why Would A Sub Include A RaiseEvent?
One of our contractors has left our company, and I have been unlucky enough to inherit his project. He was very experienced with VB6 and earlier, whereas I have only worked with VB.NET (for the last year or so) and C.

A lot of his code looks like this:

Code:
Public Event AddImage()

Private Sub HandleAddImage()
RaiseEvent AddImage()
End Sub

Public Function Add(...) As Layer
....
AddHandler MyLayer.AddImage, AddressOf HandleAddImage()
....
End Function

Public Sub Remove(...)
....
RemoveHandleer MyLayer.AddImage, AddressOf HandleAddImage
....
End Sub
Could someone give me an idea of what this code is supposed to be doing? Is this a good way to write this code? It looks very wordy to me.

Help With RaiseEvent Statement
Hey all,
I am having problems with the UserControl_MouseDown event. When I place "RaiseEvent Click" in the sub, it doesnt fire... Anyone know what could be causeing this?

Here is the code:

Code:
Private Sub UserControl_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim ctl As ddnMultiSelect
Dim lItem As Long
Dim rc As RECT
'
If (m_bDropDownMode) Then
tmrLostMouse.Enabled = False
lItem = plHitTest()
If (lItem > 0) Then
m_tItems(lItem).bChecked = Not (m_tItems(lItem).bChecked)
RaiseEvent Click
Set ctl = ObjectFromPtr(m_ptrOwner)
ctl.fItemChecked(lItem) = m_tItems(lItem).bChecked
m_tItems(lItem).bMouseDown = True
m_tItems(lItem).bMouseOver = True
pPaint
End If
Else
' rest of code....
End If
End Sub

Event/RaiseEvent
I want to use an event to update a progress bar on form1 from module1. What is the proper code to complete this task? I have never used events and the online resources I have found seem a little over my head. I am using VB6.

I call a function on module1 from form1. This function adds files to a zip file. I will use the # of total files vs the # of zipped files for the progress bars value. My problem is I have to call the function first and then update the progress bar from inside of the function back to form1. Can someone help?



Thank You

Problem With RaiseEvent
Hi,
I have a usercontrol that I'm trying to use events in and RaiseEvent.

What I have is a listview on the control and when the selected item is changed I want it to raise the

Event SelectChange(ItemIndex as Integer)

So I do it with
RaiseEvent SelectChange(ListView1.SelectedItem.Index)

But for some reason VB crashes everytime it hits the raiseevent command and I cannot figure out why. I've looked at sample programs with raiseevent used in them and copied they syntax and all exactly the same yet still vb crashes.

Anyone have any clue on how to solve this problem?

Thanks

Datarepeater Raiseevent
Hi there.

My datarepeater is now working. Thankx!
Now I created a command button in my userControl. I associated an event to that button. It gave me a code like this :

Private Sub cmdDelete_Click()
RaiseEvent btnDeleteClick
End Sub

Now How do I put the action code of that event on my form that has the datarepeater. I don't know if this is clear. Thank you.

RaiseEvent Not Triggered
Hello there,

In my struggle to get an ActiveX control implemented I have a problem in catching the RaisEvent.

If I debug the application I can see the ActiveX control is firing the getDepartmentListDone event, but the standard.exe program is not receiving this event. The Msgbox "Test" is not triggered.

Does anybody know what I do wrong??
Thanx!!!


I use the following code:

** class module DepartmentCls (ActiveX control)
Public Event getDepartmentListDone()

Public Sub getDepartmentListDone()

RaiseEvent getDepartmentListDone

End Sub

** module standard.exe
Dim WithEvents Department As DepartmentCls

Private Sub Afdeling_getDepartmentListDone()

MsgBox "Test"

End Sub

RaiseEvent And Module
Hi there,

I want to fire a public class event in my class when a subroutine in a module is ended. I can not figure out how to do this ?
The only way to fire a public class event is within a form or in a class I believe.

Does anybody have a clue how to fire the event from a module?

Many Thanx!!!

Please Help With This RaiseEvent Problem !
Hi,

I recently working on an ActiveX.exe project containing a form (Form1)
and a class module.

I want the Form1 to RaiseEvent to the class, which is possible.

I attached 2 files : project1 & project2 which are the same besides
a small thing that shouldn't change the difference between them - only if it's
if it's a bug in vb (what I think it is).

Project2 works fine and project1 don't! Why ???

Hope ypu can help me resolve that problem.

Thanks in advance , Moyalt.

ps. I've taken this example from the Karl More tutorial on Com
which is in : http://www.vbworld.com/activex/comcourse3/

RaiseEvent Problem , Please !!!
Hi,

I recently working on an ActiveX.exe project containing a form (Form1)
and a class module.

I want the Form1 to RaiseEvent to the class, which is possible.

I attached 2 files : project1 & project2 which are the same besides
a small thing that shouldn't change the difference between them - only if it's
if it's a bug in vb (what I think it is).

Project2 works fine and project1 don't! Why ???

Hope ypu can help me resolve that problem.

Thanks in advance , Moyalt.

ps. I've taken this example from the Karl More tutorial on Com
which is in : http://www.vbworld.com/activex/comcourse3/

RaiseEvent From A Form ?
Hi,

I have an Activex.exe project I'm working on.

In this project I also have a form , containing most of the code.

This ActiveX.exe project at the end will be an Exe file , called from a standard project.

The problem I have is that I want to be able to RaiseEvent from my Form and not from the Class , I know it is possible , How ?

What I did (but didn't work) :

Code in Form1 :

Public Event Hello()

private sub command1_click()

RaiseEvent Hello

End sub


Code in Class1 :

Public Event Hello()

Dim withevents ObjClass as Form1

Private sub Class_Initialize()

set Objclass = new Form1

End sub

Now I have an object in the Class1 called ObjClass
This object has an Event called Hello :

private sub ObjClass_Hello()

msgbox "Hello"

End sub

In the above code the Event not rise , also I don't have any Errors!

I think it's a bug in Visual Basic ?

Help!!!

Thanks in advance , Moyalt.

RaiseEvent Oddity
Hi There,

I'm getting some weird behaviour trapping events within a collection class.

The basic structure is
1. A form with 4 TextBoxes.
2. Each TextBox is referenced WithEvents in a class called clsKey.
3. The referenced TextBox.OnFocus Event is used to raise an event called ActivateKey, which has clsKey.Me as the parameter.
4. Each clsKey is referenced WithEvents in the collection object of a class called clsKeys.

Now here's the thing.  When any of the TextBoxes get the TextBox.OnFocus event raises the ActivateKey event.  However, this event is only trapped in clsKeys if the TextBox is not null.

Here's the code:
|Class clsKey|

Private WithEvents ctlTextBox As TextBox
Public Event ActivateKey(ByVal ActiveKey As clsKey)

Private Sub ctlTextBox_GotFocus()
    RaiseEvent ActivateKey(Me)
End Sub

|Class clsKeys|

Private WithEvents objKey As clsKey
Private objActiveKey As clsKey

Private Sub objKey_ActivateKey(ByVal ActiveKey As clsKey)
    Set objActiveKey = ActiveKey
End Sub


Any ideas anyone?

ADO: RaiseEvent WillConnect
Reference: Microsoft ActiveX Data Objects 2.6 Library

Can anyone tell kindly enlighten me why I get "Compile Error: Event not found" for the following statements? I am hoping it yields control to the main form while ADO is trying to establish a database connection.

Code:Private WithEvents madoConnection As ADODB.Connection

Private Sub madoConnection_WillConnect(ConnectionString As String, UserID As String, Password As String, Options As Long, adStatus As ADODB.EventStatusEnum, ByVal pConnection As ADODB.Connection)
On Error Resume Next

    DoEvents
    RaiseEvent WillConnect(ConnectionString, UserID, Password, Options, adStatus, pConnection)

End Sub

Multithread And RaiseEvent
I make an ActiveX server in mono thread mode (one thread in project settings).

The server is connected to a multithread other COM server that launches multithread events.
This works well and events are encapsulted in only one thread.
My server works in only one thread.

BUT my server raiseevent to its clients.

And here is the problem.

An example :
In example my server is client of server 1 and server for two clients (c1 and c2).

Take the case of my server do this :

Receive two events from server 1
First event enters from server 1 in my server
Raise event to c1
Raise event to c2
Returns to server 1 from its event
Then server 1 event 2 enters and this continues

This is if all works ok but in fact here is how vb works :

Receive two events from server 1
First event enters from server 1 in my server
Raise event to c1 (for event 1 of server 1)
!!! HERE VB SLEEPS THIS THREAD AND LETS THE SECOND EVENT OF SERVER 1 TO ENTER !!!
Second event enters from server 1 in my server
Raise event to c1 (for event 2 of server 1)
!!! HERE VB SLEEPS THIS THREAD AND LETS THE SECOND EVENT OF SERVER 1 TO ENTER !!!
Raise event to c2 (for event 1 of server 1)
Raise event to c2 (for event 2 of server 1)


So as you see (i know it is not simple but i cannot do more) my server becomes somehow multithreading and not mono threadings.

Have you heard any about that ?
Do you know a solution ?

Show From From Within Ocx - Raiseevent
Hi,
I'm going crazy...
I have a usercontrol, and to reduce the number of files I've put one class in it, which will display a form, the user can search the database with that form, and with event, I let the calling program execute the query and pass the values to the form to show.
This works perfectly when I'm working in the project group with the control and a testproject, but as soon as I want to user the binairy ocx, Im getting problems...
The method I call in the class wants a parentform to show the window, I have to pass it as Object... When I run it from within the IDE, I get error 373, which basically means I can't pass an object to the class from within VB, but I can from the exe (and that works perfect...).
I removed the parentform parameter, and I can call it from within VB, which is a must for testing and debugging purposes... but here comes the fun....
The class raises events.. this doesn't work when I run the testproject in VB! :-( It works when I have an exe, but not when I run the same program in VB...
I'm running out of idea's, this sucks hard.. :-(
Anyone any ideas how to work around this bug? (I think it's a huge bug....).
I've written many controls and classes, a couple of them used forms which were located within the control/dll, and it always has worked both in VB as in the exe... Now what am I overlooking here??? :-(((
To give an idea what the class is:
Function Add_Collumn - values are passed to the form in the control where it sets listviews columns
Function Search - the function which will show the form (vbModal)
Friend Function ExectueQuery - the form calls this function, and this function raises the Execute event
Friend function GetRows - form calls the class, class raises an event

I'd say it's not very spectacular or anyhing, no weird API's,just all plain VB functions...
Anyone an idea?
Tnx a lot! :-)

Crazy D :-)
"One ring rules them all"

RaiseEvent And VbModal
I made an activex with VB6 and use RaiseEvent to send event to the client.
I made too a client under vb6 to test my control.

If i have a modal dialog box opened by the activex code then the client don't receive the raised event sent by the control (on a timer scheduler).

WHY ???

RaiseEvent Problems
Hello.
I have notice a problem when using Visual Basic.
I create an ActiveX control (MyUserControl.ocx) that can Raise events in MyApplication.
When MyUserControl.ocx Raise events, I check the 'EventsFrozen' property, to avoid an events loss in MyApplication:

Do
RaiseEvent MessageComeIn()
Loop While EventsFrozen = True

All the events works properly until I tried to cause an event from "Form_Load()"
This causes the EventsFrozen to locked in True state, even so I handle this event. This cause the application to be stuck in infinite loop.
Are you familiar with such a problem ?
Please advice.

Thanks and Regards
Alex

ActiveX Control && RaiseEvent
Hey all,

I have an ActiveX Control Project. The Usercontrol has an event Activate. Now I have some code in a module.

How can I raise the event from the usercontrol from inside a function in the module? I can't seem to find out how to do this. I could simply place the code in the usercontrol, but it would be nicer if it could stay in the module.

RaiseEvent In Class Not Firing
Inside my class i have set an event:

in the declarations:
Public Event GetError(ByRef estring As String, ByRef enumber As Integer)

Then in the Let statement to validate the input:
If Len(vData) = 0 Or IsNull(vData) Then
RaiseEvent GetError("Invalid Input Value", "22")
Else
mvarArgValue = vData
End If


The program is an acitvex, so in my usercontrol, i have:
Dim WithEvents objError As clsCheckArg

Under the initialize sub:
Set objError = New clsCheckArg

Then finally the code to handle the event:
Private Sub objError_GetError(estring As String, enumber As Integer)
MsgBox "Error #" & enumber & ": " & estring, vbDefaultButton1, "Argument Error"
End Sub


I've been working on this simple thing all day, but its just not working. When i go through the code with F8 line by line, it reads the RaiseEvent line but doesn't actually call it, it just goes onto the next line beneath it.

Does anyone know why this is happening?

Why Can't You RaiseEvent Is Class_Initialise Events?
Why can't you RaiseEvents in Class_Initialise event?

Woka

Using An OCX In A DLL (Accessing Methods) RaiseEvent??? Need Help Please!
Since I'm getting absolutley nowhere on my other thread I'll revise this one with the new info that I know.

I'm creating a web page that utilizes a DLL. I need the DLL to process ZIP files. In order to do that I'm using the AddZIP/AddUNZIP OCX Controls. In order to use those (I think) I need to add a form to drop them on. The problem is when I try to VIEW the zip files (havn't got to unzipping yet ) I can't access that method. It's like it never runs? I can access other properties of the control like "ArchiveName", just not the methods themselves.

Now I've been reading up on the whole RaiseEvent thing but am still unclear. Is that something I need to do here?

I'm totally stumped and am desperate for any kind of lead on what to do next. Any help would be extremely appreciated.

RaiseEvent From A Standard Module...
I am subclassing a window from an AX DLL and I would like to raise events when I get certain messages. However, you can only subclass using a standard module, and can only raiseevents from object modules. There may be an easy work around, but my brain refuses to function, seeing as how I'm at work.

Raiseevent In Class From A Form?
Is it possible to raise andevent of a class from a form in the same project?

Class RaiseEvent Question
Hello,

I was just curious:

Say you set up a file search class to search through sub folders and return each file name that is found by raising an event (FoundFile). Then lets say that you just want to use the class to count the files (which it will do and store the number in a property, so you don't bother to put any code in the FoundFile Event.

If the event is firing with each file found, but there's no code within the FoundFile event, will this still take time to process an event that does nothing ???

In other words, would it be better to provide a setting in the class to prevent the event from being raised if you're not going to provide code for the event, as a way to help speed/performance ???

(Yes I know there are API's etc. for File Searching, I'm just curious about servicing events within computational loops in a class, when you won't always code for the event)

Thanks for any insight !!

Copyright 2005-08 www.BigResource.com, All rights reserved