Click to See Complete Forum and Search --> : using a control in a formless program
Ehsan
March 28th, 2001, 04:52 AM
Hi
I have a VB program that starts from Sub Main and It has not any form but I want to use a control. How can I use this control without any form that i can drop my control on it?
Clearcode
March 28th, 2001, 04:59 AM
Erm, you can't really.
You see the events that a control fires are really only wrappers to the windows messages that the contol's window raises and most of the methods are likewise.
Without a parent window on which the control is places, these WM_PARENTNOTIFY messages will go nowhere.
If it's not a silly question - why do you want a control but no window? There may be another solution.
Hope this helps,
Duncan
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Ehsan
March 28th, 2001, 05:03 AM
Hi and thanks for your response
I answer to your question:
because my control task is establishing a http connection and sending some info to a server but I dont have anything to display and my program starts automatically and must be terminated automatically
thanks
Ehsan
Clearcode
March 28th, 2001, 05:13 AM
You can create a form and not show it.
To use the form (if it is called frmConnect, and the HTTP control is called ctlConnect)
public Sub Main()
Dim myFrm as frmConnect
set myFrm = new frmConnect
With myFrm.ctlConnect
'\\ do some processing
End With
set myFrm = nothing
End Sub
HTH,
Duncan
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Ehsan
March 28th, 2001, 06:01 AM
Thanks but I have some probles yet.
when I destroy the form using
set xxx = nothing
the form destroys but I want to terminate the program too. how can I do it?
Thanks a lot
Ehsan
Cubbie
March 28th, 2001, 06:11 AM
Use the End Statement after unloading the form in the form_unload event.
form = Nothing
End
Cimperiali
March 28th, 2001, 06:14 AM
If program do not terminate after you destroy the form, you have something still loaded. Check for object you dinamically loaded and unload them and set them to nothing. Maybe you do not effectively destroied the form, if you used it to create a control (= unload and destroy the control first).
Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
Cimperiali
March 28th, 2001, 06:17 AM
I would check for not unloaded object or active references, first
Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.