How to use "unload form", "form.hide", "form.visible =false "? 
Author Message
 How to use "unload form", "form.hide", "form.visible =false "?

Hi, thank you to read my mail, if you can pls help me.
 I always get the "illeagal operation" error message when I run my vb5.0
project, what is wrong? I am so frustrated about this error message.
I have form A,B,C,D and S. FormS is a public search form which called by
other forms like A,B,C,D.
In form A,       Private sub cmdSeach_click()
                 load formS
                formS.txtparameter1.text="table1"
                        formS.show vbmodal
                txtcalling.text=gloalvar1

in form B,        Private sub cmdsearch_click()
                  Load formS
                      formS.txtparameter1.text="table2"
                  formS.show vbmodal
                  txtcalling.text=gloalvar1                            

in formS,        Private sub Form_Activate()
                 dim LStable as string
                     lstable=txtparameter1.text
                 datacontrol1.recordset=database1.openrecordset(LStable)

The problem is here:   Private sub grid_dblclick()    ' this grid is bound
to datacontrol1
                         gloalvar1=grid.columns(1)
                                 unload me      <--  when I step run to
here, illeagal message came out and vb5 quit
                   The details of this illeagal is : dbgrid32.dll illeagal

 Actually I have 4 questions:
1) How to transfer varibles between forms beside using gloabl variables?
     Now I use the hidden text box on both forms, but only when the form
activate then can get the value.
     Is there any better or more standard way to do it?
2) FormA call to formS, Where to unload formS? In formS or in formA ?
3) What is difference between form.hide and form.visible=false? Is it the
same?
4) What is hell about this "illeagal operation"?

Any help is greatly appreciated.  



Tue, 06 Mar 2001 03:00:00 GMT  
 How to use "unload form", "form.hide", "form.visible =false "?
Grace Dai

Quote:
> Hi, thank you to read my mail, if you can pls help me.
>  I always get the "illeagal operation" error message when I run my vb5.0
> project, what is wrong? I am so frustrated about this error message.
> I have form A,B,C,D and S. FormS is a public search form which called by
> other forms like A,B,C,D.
> In form A,       Private sub cmdSeach_click()
>                  load formS
>                 formS.txtparameter1.text="table1"
>                         formS.show vbmodal
>                 txtcalling.text=gloalvar1

> in form B,        Private sub cmdsearch_click()
>                   Load formS
>                       formS.txtparameter1.text="table2"
>                   formS.show vbmodal
>                   txtcalling.text=gloalvar1

> in formS,        Private sub Form_Activate()
>                  dim LStable as string
>                      lstable=txtparameter1.text
>                  datacontrol1.recordset=database1.openrecordset(LStable)

> The problem is here:   Private sub grid_dblclick()    ' this grid is bound
> to datacontrol1
>                          gloalvar1=grid.columns(1)
>                                  unload me      <--  when I step run to
> here, illeagal message came out and vb5 quit
>                    The details of this illeagal is : dbgrid32.dll illeagal

>  Actually I have 4 questions:
> 1) How to transfer varibles between forms beside using gloabl variables?
>      Now I use the hidden text box on both forms, but only when the form
> activate then can get the value.
>      Is there any better or more standard way to do it?
> 2) FormA call to formS, Where to unload formS? In formS or in formA ?
> 3) What is difference between form.hide and form.visible=false? Is it the
> same?
> 4) What is hell about this "illeagal operation"?

> Any help is greatly appreciated.

Hi Grace,

1) How to transfer varibles between forms beside using gloabl variables?
     Now I use the hidden text box on both forms, but only when the form activate then can
get the value.
     Is there any better or more standard way to do it?

    The way you use runs fine ; the other solution is to have in your form a proc like :
Public Function use (param as..., param2 as...,...).
    Then you call : errcode = yourform.use( param1, param2, ....)
    I n your form, you do something like :
    Public function use( param1 as..., ........)

        'do something with the parameters
        me.show vbModal
    End Function

    then, you need to put where you called   errcode = yourform.Use(..........) :
    unload yourform
    set yourform = NOTHING

2) FormA call to formS, Where to unload formS? In formS or in formA ?
    the best way to unload a form is in the procedure which called it.
    yourform.show vbModal
    'stop to wait the form to be hidden
    'then this proc can go on
    unload yourform
    set yourform = nothing

3) What is difference between form.hide and form.visible=false? Is it the same?
    hide hides the form, and if it was called as modal, then returns to the proc which
called the form
    visible to false hide the form, and waits for further code or events

4) What is hell about this "illeagal operation"?
    I don't know

Regards.

Christian Hugoud



Tue, 06 Mar 2001 03:00:00 GMT  
 How to use "unload form", "form.hide", "form.visible =false "?
Hi, Christian,
   Thanks a lot for your help. ;-)
    Although I do not quitely understand the way you mentioned to transfer
variables, but at least I know my way is also applicable. I tried to unload
targe form from calling form, it seems solved the "illegal error message"
problem.
   Regards.
Grace Dai


Wed, 07 Mar 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How to use "unload form", "form.hide", "form.visible =false "?

2. How to use "unload form", "form.hide", "form.visible =false "?

3. "UNLOADING" forms question

4. One form "show" another form

5. Forms "talking" to other forms

6. OO, "forms within forms"?

7. Form larger than "Form"

8. Form larger than "Form"

9. *"*-.,._,.-*"* I"LL TRADE VISUAL C++ FOR VBASIC *"*-.,_,.-*"*

10. Send form using Outlook, "For Astrid"

11. Using "age" function in Word form

12. Using ActiveX controls as "dynamic forms"?

 

 
Powered by phpBB® Forum Software