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




ActiveX Control Event Cancel


I am making a Usercontrol that has Event that needs to be canceled by the user, similar to the unload event on forms.

Private Sub Form_Unload(Cancel As Integer)
Cancel = -1
End Sub

This will prevent the form from unloading.

How would I do this in a Usercontrol? How do I get the user change to event Variable Cancel into my Control?

Event StopEdit(Cancel as Integer)

Private sub StartEdit()
Dim Cancel as Integer

Cancel = 0
RaiseEvent Stopedit(Cancel)

If Cancel =0 then
    Do the Edit
end if

end sub

Thank you,
Ganthorn







Edited by - Ganthorn on 11/11/2005 11:40:38 AM




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Cancel The Click Event In The Image Control
I inserted image control (to make it a background for some controls) on the sheet and then I placed some controls like command after I made the image "send backward" and controls "send forward" . When I run the project the controls appear on the image. But when I click on the image the controls disappear and then appear again when I move the mouse away from the image. How to fix this problem. By the way I tried to make the propert of image, Enable= false, But it didn't success .

thank you for help.

SSTab On ActiveX Control And CmdButton.Cancel =True Doesn't Work
I have a SStab on an UserControl. The UserControl has DefaultCancel = True. Now when you drop that UserControl on a dialog box. The Cancel button on the dialog box has the property Cancel = True.

The Usercontrol has a number of other objects on it. If the focus is on any object even on objects inside the tab, pressing the escape key will work. If the focus is on one of the tabs (of the SSTab,) pressing escape key doesn't do anything. QA and Product management wants it work. How do I do that?

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

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

Thnx in advance,

Naveen !!!!!

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

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

Thnkx in advance,

Naveen !!!!!

ActiveX Event Control Question
Hi all,

I'm sorry if this is a stupid question, but I've been trying to figure it out for a few hours now.

I have added the reference of the control and am using Excel to store the data.

The control has events associated with it that I would like to be able to use. They look like this:

Event OnMsgReceivedEvent(NumMsgs As Long)
Event OnDataGathered(DataArrived As Boolean)

I'm creating an instance of the control like this:
Public WithEvents myNewCanControl As CanControl

I was told that I have to set the instance to New like so:
Set myNewCanControl = New CanControl


I have a few questions:

1. To do anything during the OnMsgReceivedEvent event I do it like this, right?

Private Sub myNewCanControl_OnMsgReceivedEvent(NumMsgs As Long)
MsgBox ("Number of msgs received:" & NumMsgs)
End Sub

2. Is there something that I can to do make the event happen whenever I want?

3. Where do I "Set" the instance to New? I believe that I read that is has to be done in a function or sub


Thanks in advance,
Jason

Adding An Event To A ActiveX Control
How will you add a new event to an ActiveX control.

ActiveX Control UserControl Terminate Event
I wrote an ActiveX Control that contains the Windows Media Player and Flash Player objects. When I load this control into a browser, everything I coded runs and works perfectly...but when I close the browser (regardless of what version of IE is running it), IE errors out. I'm pretty sure I need code in the UserControl_Terminate event, but I don't really have any idea how that works. What code would go in this event? Do you have to de-initialize stuff before you close?

MR

Adding A KeyDown Event To A ActiveX Control
Can anybody tell me if this can be done? I'm using an Apax control for terminal emulation, but the control doesn't come with a KeyDown event. I would like to add the KeyDown event to the control so I can make the provisions for the arrow keys, "F" keys, etc. When the Apax control has focus, the form's KeyDown event doesn't fire. I'm using VB6 Enterprise Edition. Please help!!!

Thanks...

ActiveX Control Event Handling On HTML...
Hi all,

I have activex control developed using VB with user defined event that passes parameters.

These parameters are available when i use this control in VB.
But I couldn't get this parameters from a web page(on IE 5.0).
I tried window.event object. but this object exposes only some predefined parameters.
Could anyone give some information?

Thanks in advance
Saran.

Trigger Event From A Module In A OCX (ActiveX Control) ???
I'm getting sick by trying to Trigger a event from a modul added to a ActiveX Control ?

i did:

new ActiveX-Control
Add- Module

the i declared a event in this USERCONTROL:

public Event testevent()


now i got to trigger thi event from the Module1

how to do this

1. the function Raiseevent doesn't sheems to be able to be called in a Module
2. I Tryed to call a usual Fauntion declare as public in the Control: Im Not able to call this function from the Module i Tryed alos USERCONTROL.Function

Do someone knows some help ?





 

Excel Object ActiveX Control's Event
I have this to insert a command button into excel file open from my VB6 project:

exlObj.Worksheets(1).OLEObjects.Add "Forms.CommandButton.1", _
Left:=725, Top:=485, Height:=20, Width:=100

How to sense the click event of the same command button that I just created, from VB code.

No VBA involved.

Can Transparent ActiveX Control Response The MouseMove Event?
I'm trying to make a label like ActiveX Control. Default the BackStyle of usercontrol will be Opaque

The actions added in the Usercontrol_MouseMove will work fine. But when I change the BackStyle to
Transparent, the Usercontrol_mousemove event never fire again! That's a big problem!

You know if you set the BackStyle of a Label control in VB to Transparent, it still can response all
the mouse actions ( move, click ... ). Why the Usercontrol can not? Anybody give me some clues. Thanks!


//-----------------------------------------\
Where there's a wire , there's a way
\-----------------------------------------//

ActiveX Control Development Issue - Seeking A Lost Event...
I have created an ActiveX control composed of a label whose forecolor property is set to green. When the user moves the mouse on my control, I want the label color to change to red. That is easily accomplished in the MouseMove event of the label (Label1.ForeColor = vbRed). The problem is that I also want the label color to be restored, when the mouse pointer is NOT on the label (Label1.ForeColor = vbGreen) AS IF there was a "lost focus" event for the label. But there is not (I think a label cannot get the focus).
(I can do what I need, if in the MouseMove event of the form that contains my control, I give the command MyControl.ForeColor = vbGreen. But that's not a solution. I need this to be done INSIDE my control code and not in the ambient form's code.)

How To Detect A Click Event On Embeded Image Inside An Activex Control.
Hello All,

I need some help figuring this out. I am developing an ActiveX control that contain an array of multiple image boxes embedded inside a windowless transparent form (container). Based on property settings at design time, only one imagebox is visible, and all others are set to be invisible. I have a method (property) set in the control that decides which image is going to be visible. This is settable during a standard VB exe project development, and at run time via user selction. When I compile the OCX and use it to on a standard VB EXE project, I don't have an option available to write code for an Image click event. Only events available are control got focus, & lost focus etc. How do I go about adding the Image click event (to the Visible Image) inside my control?

Do I have to implement another method/event within my Activex control? If I did that, how would I then pass the name of the caller (name of the form where the control click was initiated) in to my activex event, and have the activex report back to the "SAME" calling form during run time?

Thanks

Custom Event Fired By The ActiveX Control Can NOT Be Received By The Hosting Webpage During Debuggin
Dear all,
I have been developping an ActiveX control under VB which will be used on a webpage. This control will fire a couple of custom events to the webpage. I have set my VB's debugging option to start a browser with the URL of the html page containing my control. When debugging this control with VB, I found that all my defined events are NOT received by the html page hosting my control. But, if I compile the control and run the html page directly, all the events appear to be fired and received perfectly. Why is this happening? Is there any way to get those events received by the html page during the debugging process?

Cancel An Event
This is for VB6. Events or processes are fired when a button is clicked, i want to be able to cancel the running processes by clicking another button(cancel). How can i do this so the Application do not freeze or become unstable. I dont want to quit the application or current form, i just want to be able to stop what its doing if the Cancel button is clicked.

How Can I Cancel VB Event
my vb version is vb6.0
if VB error raised,then.i don't want to generate the mshflexGrid 's rowcolchange event.what should i do?
thanks a lot!!i really need help!

Cancel Event
Used a macro to extract date range for a report. The macro form has a cancel button. I can close the form using the cancel button but the report still runs the query and a dialogue box asks for the date parameter. Ive tried using cancelevent in the macro and forcing a close of the report using a method in VB to no avail. I know theres prolly a simple solution to this.

Cancel Event In Webbrowser
Hello, I have some troubles, I want to cancel the focus event on webbrowser control
so i made

Dim WithEvents Win2 As HTMLWindow2

Private Sub WebBrowser1_DownloadComplete()
On Error Resume Next
Set Win2 = WebBrowser1.Document.parentWindow
End Sub

Private Sub Win2_onfocus()
Set objEvent = Win2.event
MsgBox "cancel focus"
objEvent.returnValue = False
End Sub

Message box appear, but event isn't canceled

Thanks for any help.

Cancel Event From Module
How do I refer to an event variable (local) from a public module?
Code:
Private Sub txtProofDate_Validate(Cancel As Boolean)
CheckDate (Me.ActiveControl)
End Sub
and in my module...
Code:
formname.txtProofDate_Validate.Cancel = True
I can only get cancel to work if you use Cancel = True in the validate sub on the form itself. I've tried using a public variable pubCancel = True in the validate event, but for some reason the sub doesn't actually cancel if i declare the variable as pubCancel instead of Cancel.

Cancel Event In Webbrowser
Hello, I have some trouble, I want to cancel the focus event on webbrowser control
so i made

Dim WithEvents Win2 As HTMLWindow2

Private Sub WebBrowser1_DownloadComplete()
On Error Resume Next
Set Win2 = WebBrowser1.Document.parentWindow
End Sub

Private Sub Win2_onfocus()
Set objEvent = Win2.event
MsgBox "cancel focus"
objEvent.returnValue = False


End Sub

Message box appear, but event isn't canceled

Thanks for any help.

Cancel A Click Event
Hi,

Let's say that a user clicks on a listbox's item, the click event is generated. What if after some validation, the program should move back to the previous index because something is missing etc.

How can I cancel a click event?
I tried to change the listindex to the old one, but that generates another click event.

Thanks,

Cancel Event In Inet
Ok,
i can't seem to cancel my uploads...i want to be able to cancel inet1 and stop and further uploads from occuring..
I've tried:
Form1.Inet1.Cancel
and
Form1.inet1.Execute, "CLOSE"
and
If Form1.Inet1.StillExecuting Then
Form1.Inet1.Cancel
End If
anf
If Form1.Inet1.StillExecuting Then
Form1.Inet1.Execute, "CLOSE"
End If
all seem to let the user think that the upload is canceled...but actually you can't exit the program untill it fully uploads.
I've tried asking this b4, but din't recieve much help...

Question: How do i cancel an upload? and exit a sub on form1 when a button on form2 is pressed.

Thank you,
D!m

Cancel Submit Event
how to cancel submit event after an submit button has been pressed in a html page?

How To Cancel The Click Event In A DataGrid?
I'm using a DataGrid and want to capture a click event and prevent a row change. I want to check for certain conditions in the recordset that is bound to the grid and then somehow cancel the row change if those conditions are true.

The RowColChange event only happens after the row change and it seems kind of clunky to move back to the last row and check the conditions and then allow the move if the conditions are false.

Anyone have any ideas?

Textbox Validate Event And Cancel
I use the Validate Event to Edit input in my Textboxes. I have a Cancel button setup on each form with Cancel=True set on it.

When a field that is Required Entry has focus and the User clicks the Cancel button, the Validate Event fires, due to the LostFocus that is taking place, and the Required Entry Edit fails. The ESC key does not cause the Validate Event to fire and thus ESC works just fine.

Can anyone give me an idea of something to check to keep my logic in the Validate Event from getting executed when the Cancel is clicked?????

Thanks,

John

Capturing Cancel Event On InputBox
Hi, all,

I have an inputbox where a user MUST submit a value. However, I can only code to test for the value itself, whether it's a Numeric, Null, String or Zero-Length. But on testing, I found that I can't prevent users from clicking on Cancel.

Anyone who can help?

Regards    

GoodGuy
Experience is a bad teacher for its exams precede its lessons.

Edited by - GoodGuy on 9/9/2005 7:56:09 AM

Cancel Unloading Event Of The Form
I need to validate the screen b4 the unloading of the form

If the validatin fails I need to cancel the unloading

How can i do this

I Need To Cancel/abort The Keydown Event On A Textbox
I need to evaluate the keycode the user has entered (this is the easy part) and then let the procedure either proceed OR concel the event so that the keypress doesn't end up in the textbox.

I seem to remember a 'cancel event' type command in Access Basic but can't find the equivelant in VB.

Failing that do you have any tips on input masks 'cause I don't seem to be able to make the MSMask control work (I get an error when I try to place a total into one of them).

Thank you for your time.

Stuey

Easy Q... Cancel A Form_unload Event. (Resolved=True)
I need a way to back out of the form_unload processing.

Kinda like..


VB Code:
private sub form_unload(cancel as integer)stop unloadend sub


Or something.

I'm sure this can be done, but I've never had the need, and my search efforts are being mocked by google.

Thank you.

Excel Event Automation "Cancel Function
I am automating Excel from VB.Net 2003

I have the following code to handle a before rightclick event the code is in my .Net module

 Private Sub ActiveBook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target As Excel.Range, ByRef Cancel As Boolean) Handles ActiveBook.SheetBeforeRightClick
        Cancel = True
    End Sub

I know that the code gets executed but the Cancel = True does not stop excel from showing the ShortCutMenu
If I put the Equivalent Event handling code in VBE then it works.

What am I doing wrong

Cancel Combo Update Event And Leave Value And Bound Column As Is
I'm trying to do Yes/No/Cancel BeforeUpdate. If the user chooses to Cancel I want to Combobox to stay right where it is with the value and the bound column. I have written:

Code:Private Sub cboNameSearch_BeforeUpdate(Cancel As Integer)
Dim tosave
Dim changelist
If Me.cboNameSearch.Column(1) <> "" Then
    Set changelist = CurrentDb.OpenRecordset("SELECT * FROM tblChanged WHERE user_id = '" & CurrentUser & "';")
    If Not changelist.EOF Then
        If changelist.changed = 1 Then
            tosave = MsgBox("You have made changes to this person." & Chr(13) & Chr(13) & _
                "Press OK to save changes and go to new person, " & _
                "No to go to another person without making changes, " & _
                "or Cancel to go back and make more changes.", vbYesNoCancel, "Save Changes?")
            If tosave = vbYes Then
                SavePrimary changelist.emp_id
                ResetPrimary
                ResetPosition
                UpdatePrimary Me.cboNameSearch.Column(1)
                UpdatePosition Me.cboNameSearch.Column(1)
                UpdateChanged 0, 0
            ElseIf tosave = vbNo Then
                ResetPrimary
                ResetPosition
                UpdatePrimary Me.cboNameSearch.Column(1)
                UpdatePosition Me.cboNameSearch.Column(1)
                UpdateChanged 0, 0
            ElseIf tosave = vbCancel Then
                DoCmd.CancelEvent
            End If
        Else
            ResetPrimary
            ResetPosition
            UpdatePrimary Me.cboNameSearch.Column(1)
            UpdatePosition Me.cboNameSearch.Column(1)
        End If
    Else
        ResetPrimary
        ResetPosition
        UpdatePrimary Me.cboNameSearch.Column(1)
        UpdatePosition Me.cboNameSearch.Column(1)
    End If
    changelist.Close
    Set changelist = Nothing
Else
    MsgBox "Please select an person to view."
End If


End Sub


The DoCmd.CancelEvent doesn't seem to work.

Thanks,
Jeffers

Accessing Properties Of A ActiveX Control, Inside Other ActiveX Control
I am working with some ActiveX Control with ASP. My question is that "In ASP, how can we access properties of one ActiveX control which is wrapped inside other ActiveX control, so that threw those properties we can intract with Server Side" Please help me and reply at your earliest.

Regards,
Vivek.

Help With Cancel Using ADO Control
Hello All,

New to VB -
I'm trying to convert an MS Access application into a VB front-end with an access back-end, Working with ADO controls.
How do I program the cancel button so that the user can click it to 'not' save his edits or new record data and return the record to it's prior settings.

Thanks AccessGuruCarl
  Programmers helping programmers
  you can't find a better site.


Use Of "Cancel" Argument In Form_Unload Event ??
Hi All,

Can Anybody tell me what is the purpose of using "Cancel" argument in Form_Unload / Form_QueryUnload events ??

Thanks & Regards
ashwin.

Input Box Cancel + Control Element
hi there

if i have an inputbox and the user presses cancel, i get a type mistmatch error on the line of the inputbox

what should i do? i tried:


Code:
if vbCancel then
menuentrynumbers = 0
end if

but still didnt work

this is the line pointing at the problem:


Code:
menuentrynumbers = InputBox("Please Enter the NUMBER of Menu item headers in your Application " + vbCrLf + vbCrLf + "i.e There maybe a File Menu, an About Menu, an Application Menu = 3 menu items", "Number of Menu items", 0)




thats problem 1


i still cant get the problem sorted where, in my for loop, it creates 1 text box - but i want to create more than 1 text box and i think i have done it in the code but dont seem to work!


Code:
For counter = 1 To menuentrynumbers

subnumbermenuentryname = InputBox("Enter the NUMBER of SUB MENU items in the " & UCase(txtField(counter).Text) & " Menu Header", "Sub Menu Items", 0)

For numberofentrysubmenuname = 0 To subnumbermenuentryname - 1

submenuentryname = InputBox("Enter the Sub Menu Name number " & numberofentrysubmenuname + 1 & " for the menu title: " & UCase(txtField(counter).Text))
MsgBox ("sub entry name for menu: " & txtField(counter).Text & " " & submenuentryname)


i = txtField.Count


a = i '+ 1

Load txtField(a)
txtField(a).Visible = True
txtField(a).Enabled = False

txtField(a).Left = txtField(a).Left + txtField(a).Width


txtField(a).Text = txtField(counter).Text & submenuentryname

Next numberofentrysubmenuname

Next counter

at the second for loop - it creates 1 text box but then when it loops again it doesnt seem to create it - i get NO errors

what am i doing wrong?

'cancel' Pop Up Alerts In The Webbrowser Control?
Hello...

I have a webbrowser control integrated into my program that must connect to a remote server which is located on host that uses a variety of advertising methods, including recently automatically popping up the 'add to favorites' box - the webbrowser I am using has its silent property set to 'true' at runtime, but I am still getting these 'add to favorites' boxes despite this silent property, even worse the browser will open up additional ad popups when the 'add to favorites' box is up and apparently silent can do nothing to stop them, it sometimes even leads to system crashes... is there any way to disable these alerts? I thought the silent property was supposed to disable all kinds of notification through the webbrowser? Is there anyway to 'cancel' these alerts automatically once they have been popped up?

Any ActiveX Control Expert Login Here Can Solve My Problem Relating To ActiveX Contro
I am creating an ActiveX control , control is a text box where i want to add Multiline and Scroll Bar Properties in my Textbox ActiveX control, any one of u can help me, plz reply with complete solttion.

Zubair Khan

Common Dialogue Control - Cancel Crashs
Hi all,

Ive got a save and load button linking in the CDC running ok, but if you press cancel on it, it crashes.

Ive pasted the code im using at the bottom

Ive tried using this:

if commondialogue1.filename = "" then
end sub

end if

but it doesnt like me for that

cheers

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '

Code:
Private Sub cmdsave_Click()

With CommonDialog2
.DialogTitle = "Select Where to Save to"
.InitDir = "C:"
CommonDialog2.Filter = "DCFC Game Data (*.txt) | *.txt" 'this event actually displays the open dialog box


End With

Open CommonDialog2.FileName For Output As #1
Print #1, Form1.Text1.Text
Print #1, Form1.Text2.Text
Print #1, Form1.Text3.Text
Close #1



End Sub

Private Sub cmdload_Click()


With CommonDialog1
.DialogTitle = "Select File to Load"
.InitDir = "C:"
CommonDialog1.Filter = "DCFC Game Data (*.txt) | *.txt"
.ShowOpen


End With





Dim strInput As String

Open CommonDialog1.FileName For Input As #1

Input #1, strInput
Form1.Text1.Text = strInput

Input #1, strInput
Form1.Text2.Text = strInput

Input #1, strInput
Form1.Text3.Text = strInput
Close #1

End Sub

Inet Control Cancel Takes Forever!!
I have a cancel control on a project I'm doing which needs to upload files to an FTP server. If I'm part way through a file and I cancel it takes a minute to finish this PLUS the VB stop and pause stay for a minute and I can't touch the code in the meantime.

I just used the following code to cancel:

If Inet1.StillExecuting Then
Inet1.Cancel
End If
Do While Inet1.StillExecuting
DoEvents
Loop

Is there any way I can make cancel faster? I know there must be a way because all the FTP programs I've used cancel nearly instantly! Thanks a ton.

ADODC Control: Cancel WillMove Method
I am using the following code the cancel a move when I am at the begging/end of a recordset. Does anyone know why right after this method/code is executed a message box is pops up displaying the following message "Operation was canceled".

How can I stop the message from popping up?
 

Private Sub Adodc1_WillMove(ByVal adReason As ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)

    If pRecordset.EOF Or pRecordset.BOF Then
        adStatus = adStatusCancel
        Exit Sub
    End If

End Sub

Add Event To ActiveX
i want to add the change event to an activeX object.
i want it to occur when a chnage event occur in one of its components.
how can i do that?

CommonDialog Control Cancel Button Not Generating Error?
Hi All,
I'm trying to capture when a user hits the cancel button on my fileopen CommonDialog control, but it's not going to the errorhandler line.

Any idea why not?

Here's my code:


VB Code:
Public Sub SelectFile()    On Error GoTo errorhandler    FileSelect01.Flags = cdlOFNExplorer Or cdlOFNHideReadOnly    FileSelect01.ShowOpen    testfileloc = FileSelect01.FileName        If testfileloc <> "" Then        For cn1 = 1 To Len(testfileloc)            If Mid(testfileloc, cn1, 1) = "" Then                slash_pos = cn1                Debug.Print slash_pos            End If            If Mid(testfileloc, cn1, 1) = "." Then                punkt_pos = cn1                Debug.Print punkt_pos            End If        Next cn1        File_trim = Mid(testfileloc, (slash_pos + 1), ((punkt_pos - slash_pos) - 1))        DoEvents        ShowEv = True    End If    Call Log_Append(CStr(Log_File_Dir), CStr(strCompName), "Work File Selected.", CStr(testfileloc))    Exit Sub errorhandler:    Call Log_Append(CStr(Log_File_Dir), CStr(strCompName), "Work File Selection", "Cancel Button Selected.")    Debug.Print Err.NumberEnd Sub

Trouble With The Cancel Button In The Common Dialog Control
whenever i test it and click cancel, it crashes me proggy

then when i use "On Error Resume Next" it crashes and times out my proggy, and i have to alt ctrl del to close it

could you suggest what i could be missing from this?

Help With ActiveX Dll Project, ActiveX Exe And ActiveX Control
help. im using visual basic 6 on win 2000 pro, i am unable to create a
new activeX dll project, activeX exe and activeX control, along with
things missing from the compilation; options window . ohh and also i
cant add a user control, property page, user document. i don't know what
would be missing for me not to use these options, ,, please I need help

How Does An Event Get Triggered By Activex?
I'm using this DMFitter ActiveX: http://fitting.datamaster2003.com/
here is my code:

Code:
Public Lambda, hindex, lindex, sindex, RVal, La, Ta, Ra, Ma, FilmP, I, datasheet, Paramters, Sigmas, X, Y, Options
Public WithEvents myFitter As Fitter.DMFitter
Sub Command1_click()
Set myFitter = CreateObject("Fitter.DMFitter")
myFitter.X = X
myFitter.Y = Y
myFitter.Expression = -2
myFitter.ParamCount = 2
myFitter.Parameters = myParameters
myFitter.Sigmas = mySigmas
myFitter.Iterations = 30
myFitter.WeightType = 0
myFitter.Options = "no"
If myFitter.LMFit Then
Else
MsgBox "myFitter error " & myFitter.ResultCode 'Debug.Print myFitter.ResultCode
End If
End Sub

all the variables are defined elsewhere.

event OnGetLMFunction(X, Parameters) is supposed to be fired by LMFit when it starts its process. I placed a breakpoint at

Code:
Sub DMFItter_OnGetLMFunction(ByVal X As Variant, ByVal Parameters As Variant) 'As Double
FilmP(3) = Parameters(0) 'index
FilmP(4) = Parameters(1) 'thickness
myFitter_OnGetLMFunction = Rpc((Lambda), (Si), 2, FilmP)
End Sub
Sub DMFitter_OnGetLMDerivative(ByVal X As Variant, ByVal Parameters As Variant, ByVal Sigmas As Variant) 'As Variant
Dim Result(3) ' Notice: in THIS case, Parameters and Sigmas not used
Result(0) = 1 ' (because model is linear, and fix flags not used)
Result(1) = X
Result(2) = X ^ 2
Result(3) = X ^ 3
myFitter_OnGetLMDerivative = Result
End Sub

but nothing happens, and I get FitResult = 3 "Incorrect parameters or data to be fitted" so I'm guessing it never gets to function definition.


Quote:




event OnGetLMFunction(X, Parameters): double

This event handler must return the value of NLSF model function. X is an independent variable (array or single double precision float), Parameters is of type OleVariant and contains array of double precision values of fitting parameters. Notice that X is always of type OleVariant and if you set 2D array for X property, X parameter will be an array with appropriate number of elements.

event OnGetLMDerivative(X, Parameters, Sigmas): OleVariant

You define this event handler if you wish to calculate LM partial derivatives analytically. X and Parameters are the same as in OnGetLMFunction, Sigmas is of type OleVariant and contains array of double precision values of parameter fix flags: if Sigmas[i]<0, you can leave zero value of appropriate partial derivative. You must return an array of double precision values of partial derivatives. See TestLMFitEvents.htm and TestLMFitEJS.htm examples for more details.





I'm going straight from the example, and nothing..

I'm guessing I did not define the event handler for DMFitter that will point to the example Sub shown above, can someone please explain how this is can be done?

Form_Load Event From ActiveX
Hi there guru's!

I'm struggling with a problem, I'm trying to pass the Forms object into an ActiveX control with the view of trapping the Form_Load event to fire off some stuff from my ActiveX.

The idea being you drop one control onto the main form, do a set Actx.Forms = Forms and hey presto it takes care of the rest every time a form is displayed..

Can anyone help?

ActiveX Click Event
I want to create a combo box control not too many problems
there. I am having trouble exposing the combo's events. I
created a click event in the control, but when I test the control in
another project added to create a project group, I can see the
click event but nothing happens when I click an combo item.

I added the Procedure ID to be the click event for Click. I know I
am missing something here, but its been a long day.

VB Code:
'ControlOption Explicit Public Event Click() '...'...  'Test projectOption Explicit Private Sub MyCombo1_Click()    MsgBox "Click" 'Nothing happensEnd Sub '...'...  
Thanks for any assistance.

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