Thread View: comp.lang.basic.visual
9 messages
9 total messages
Started by sjoerd
Wed, 23 Jul 2003 10:35
VB6 Bug?
Author: sjoerd
Date: Wed, 23 Jul 2003 10:35
Date: Wed, 23 Jul 2003 10:35
24 lines
1779 bytes
1779 bytes
Hi, I have a problem in a MDI-project. I declared a variable MyVarAA in frmMain.frm (Public MyVarAA) in the General Declaration section) I need this variable in Form1, so in the Form_Load of this form I wrote: MyVarBB = frmMain.MyVarAA When trying to run the program I get the following error: Run-time error 426 (only one MDI-form allowed). The debug-information tells me: frmMain.MyVarAA = <object variable or with block variable not set> Acoording to the book I use (Using Visual Basic 6) is this the way to do it. Error in the Book? Bug in VB? Something else? Thanks, Sjoerd
Re: VB6 Bug?
Author: Patrick Hayes
Date: Wed, 23 Jul 2003 10:39
Date: Wed, 23 Jul 2003 10:39
5 lines
1378 bytes
1378 bytes
> Run-time error 426 (only one MDI-form allowed). set Child property of Form1 ? - patrick
Re: VB6 Bug?
Author: sjoerd
Date: Wed, 23 Jul 2003 11:24
Date: Wed, 23 Jul 2003 11:24
11 lines
1526 bytes
1526 bytes
> > Run-time error 426 (only one MDI-form allowed). > > set Child property of Form1 ? > > - patrick > > MDIChild = True Sjoerd
Re: VB6 Bug?
Author: Jan Hyde
Date: Wed, 23 Jul 2003 12:25
Date: Wed, 23 Jul 2003 12:25
49 lines
2311 bytes
2311 bytes
"sjoerd" <iwi@iwi.myweb.nl>'s wild thoughts were released on Wed, 23 Jul 2003 12:35:00 +0200 bearing the following fruit: >Hi, > >I have a problem in a MDI-project. >I declared a variable MyVarAA in frmMain.frm (Public MyVarAA) in the General >Declaration section) > >I need this variable in Form1, so in the Form_Load of this form I wrote: > >MyVarBB = frmMain.MyVarAA > >When trying to run the program I get the following error: > >Run-time error 426 (only one MDI-form allowed). > >The debug-information tells me: > >frmMain.MyVarAA = <object variable or with block variable not set> > >Acoording to the book I use (Using Visual Basic 6) is this the way to do it. >Error in the Book? Bug in VB? Something else? > >Thanks, > >Sjoerd > Dim frm as frmMDIMain '-- Load an instance of the MDI form set frm = New FrmMDIMain frm.Show '-- Causes another instance of the MDI to load frmMDIMain.Caption = "Ooops" '-- Does not cause another instance to load frm.Caption = "Correct' J -- So I said "Do you want a game of Darts?", he said "OK then", I said "Nearest to bull starts". He said "Baa", I said "Moo", he said "You're closest". [Abolish the TV Licence - http://www.tvlicensing.biz/]
Re: VB6 Bug?
Author: sjoerd
Date: Wed, 23 Jul 2003 19:32
Date: Wed, 23 Jul 2003 19:32
62 lines
3039 bytes
3039 bytes
"Jan Hyde" <StellaDrinker@REMOVE.ME.uboot.com> wrote in message news:ohvshvk1jgtihtm0u278gjtpskd7e2k0me@4ax.com... > "sjoerd" <iwi@iwi.myweb.nl>'s wild thoughts were released on > Wed, 23 Jul 2003 12:35:00 +0200 bearing the following fruit: > > >Hi, > > > >I have a problem in a MDI-project. > >I declared a variable MyVarAA in frmMain.frm (Public MyVarAA) in the General > >Declaration section) > > > >I need this variable in Form1, so in the Form_Load of this form I wrote: > > > >MyVarBB = frmMain.MyVarAA > > > >When trying to run the program I get the following error: > > > >Run-time error 426 (only one MDI-form allowed). > > > >The debug-information tells me: > > > >frmMain.MyVarAA = <object variable or with block variable not set> > > > >Acoording to the book I use (Using Visual Basic 6) is this the way to do it. > >Error in the Book? Bug in VB? Something else? > > > >Thanks, > > > >Sjoerd > > > > > Dim frm as frmMDIMain > > '-- Load an instance of the MDI form > set frm = New FrmMDIMain > frm.Show > '-- Causes another instance of the MDI to load > frmMDIMain.Caption = "Ooops" > '-- Does not cause another instance to load > frm.Caption = "Correct' > > J > > > -- > So I said "Do you want a game of Darts?", he said "OK then", I said > "Nearest to bull starts". He said "Baa", I said "Moo", he said > "You're closest". > > [Abolish the TV Licence - http://www.tvlicensing.biz/] > Can't get your solution working. It gave me the idea to create a new "normal" form (form2) and declare the variables on this form. Then load form2 in form1 when form1 is loaded and showed. This solution works. Keep wondering why declaring in frmMain generates the error. Sjoerd
Re: VB6 Bug?
Author: Don
Date: Wed, 23 Jul 2003 20:28
Date: Wed, 23 Jul 2003 20:28
64 lines
3149 bytes
3149 bytes
On Wed, 23 Jul 2003 21:32:56 +0200, "sjoerd" <iwi@iwi.myweb.nl> wrote: > >"Jan Hyde" <StellaDrinker@REMOVE.ME.uboot.com> wrote in message >news:ohvshvk1jgtihtm0u278gjtpskd7e2k0me@4ax.com... >> "sjoerd" <iwi@iwi.myweb.nl>'s wild thoughts were released on >> Wed, 23 Jul 2003 12:35:00 +0200 bearing the following fruit: >> >> >Hi, >> > >> >I have a problem in a MDI-project. >> >I declared a variable MyVarAA in frmMain.frm (Public MyVarAA) in the >General >> >Declaration section) >> > >> >I need this variable in Form1, so in the Form_Load of this form I wrote: >> > >> >MyVarBB = frmMain.MyVarAA >> > >> >When trying to run the program I get the following error: >> > >> >Run-time error 426 (only one MDI-form allowed). >> > >> >The debug-information tells me: >> > >> >frmMain.MyVarAA = <object variable or with block variable not set> >> > >> >Acoording to the book I use (Using Visual Basic 6) is this the way to do >it. >> >Error in the Book? Bug in VB? Something else? >> > >> >Thanks, >> > >> >Sjoerd >> > First off I don't know why you want to do it this way BUT here's something to look at... In the MDIForm do: Option Explicit Public MyVarAA As MDIForm1 'Declare an Object Varible Private Sub MDIForm_Load() 'Just declaring it is only half the process. Have to use the 'Set blah = blahblah to actually create the references.. Set MyVarAA = MDIForm1 'Set the references to This Form End Sub Then in Form1 (MDIChild form) do: Option Explicit Dim MyVarBB As MDIForm1 'Declare an Object Varible (early binding) Private Sub Form_Load() Set MyVarBB = MDIForm1.MyVarAA 'Set the References to that in MDIForm 'Now MyVarBB has all the references of MDIForm1 End Sub Have a good day... Don
Re: VB6 Bug?
Author: Don
Date: Wed, 23 Jul 2003 20:33
Date: Wed, 23 Jul 2003 20:33
83 lines
3595 bytes
3595 bytes
I forgot to mention the following:: In the MDI Child form you could also do: Option Explicit Dim MyVarBB As MDIForm1 Private Sub Form_Load() Set MyVarBB = MDIForm1 'Not Using .MyVarAA it will be the same (kinda) 'In this case MyVarAA in the MDIForm is not needed at all... MyVarBB.Command1.Visible = False End Sub On Wed, 23 Jul 2003 20:28:46 GMT, Don@home.com wrote: >On Wed, 23 Jul 2003 21:32:56 +0200, "sjoerd" <iwi@iwi.myweb.nl> wrote: > >> >>"Jan Hyde" <StellaDrinker@REMOVE.ME.uboot.com> wrote in message >>news:ohvshvk1jgtihtm0u278gjtpskd7e2k0me@4ax.com... >>> "sjoerd" <iwi@iwi.myweb.nl>'s wild thoughts were released on >>> Wed, 23 Jul 2003 12:35:00 +0200 bearing the following fruit: >>> >>> >Hi, >>> > >>> >I have a problem in a MDI-project. >>> >I declared a variable MyVarAA in frmMain.frm (Public MyVarAA) in the >>General >>> >Declaration section) >>> > >>> >I need this variable in Form1, so in the Form_Load of this form I wrote: >>> > >>> >MyVarBB = frmMain.MyVarAA >>> > >>> >When trying to run the program I get the following error: >>> > >>> >Run-time error 426 (only one MDI-form allowed). >>> > >>> >The debug-information tells me: >>> > >>> >frmMain.MyVarAA = <object variable or with block variable not set> >>> > >>> >Acoording to the book I use (Using Visual Basic 6) is this the way to do >>it. >>> >Error in the Book? Bug in VB? Something else? >>> > >>> >Thanks, >>> > >>> >Sjoerd >>> > > >First off I don't know why you want to do it this way BUT here's something to >look at... > >In the MDIForm do: > >Option Explicit >Public MyVarAA As MDIForm1 'Declare an Object Varible > >Private Sub MDIForm_Load() >'Just declaring it is only half the process. Have to use the >'Set blah = blahblah to actually create the references.. >Set MyVarAA = MDIForm1 'Set the references to This Form >End Sub > >Then in Form1 (MDIChild form) do: > >Option Explicit >Dim MyVarBB As MDIForm1 'Declare an Object Varible (early binding) > >Private Sub Form_Load() >Set MyVarBB = MDIForm1.MyVarAA 'Set the References to that in MDIForm >'Now MyVarBB has all the references of MDIForm1 >End Sub > > >Have a good day... > >Don Have a good day... Don
Re: VB6 Bug?
Author: preben nielsen
Date: Thu, 24 Jul 2003 05:04
Date: Thu, 24 Jul 2003 05:04
14 lines
1562 bytes
1562 bytes
"sjoerd" <iwi@iwi.myweb.nl> skrev i en meddelelse news:bfmntj$g15$1@news1.tilbu1.nb.home.nl... > Can't get your solution working. It gave me the idea to create a new > "normal" form (form2) and declare the variables on this form. Why a form ? This is what a module is meant for ! -- /\ preben nielsen \/\ prel@post.tele.dk
Re: VB6 Bug?
Author: Jan Hyde
Date: Thu, 24 Jul 2003 08:38
Date: Thu, 24 Jul 2003 08:38
76 lines
3285 bytes
3285 bytes
"sjoerd" <iwi@iwi.myweb.nl>'s wild thoughts were released on Wed, 23 Jul 2003 21:32:56 +0200 bearing the following fruit: > >"Jan Hyde" <StellaDrinker@REMOVE.ME.uboot.com> wrote in message >news:ohvshvk1jgtihtm0u278gjtpskd7e2k0me@4ax.com... >> "sjoerd" <iwi@iwi.myweb.nl>'s wild thoughts were released on >> Wed, 23 Jul 2003 12:35:00 +0200 bearing the following fruit: >> >> >Hi, >> > >> >I have a problem in a MDI-project. >> >I declared a variable MyVarAA in frmMain.frm (Public MyVarAA) in the >General >> >Declaration section) >> > >> >I need this variable in Form1, so in the Form_Load of this form I wrote: >> > >> >MyVarBB = frmMain.MyVarAA >> > >> >When trying to run the program I get the following error: >> > >> >Run-time error 426 (only one MDI-form allowed). >> > >> >The debug-information tells me: >> > >> >frmMain.MyVarAA = <object variable or with block variable not set> >> > >> >Acoording to the book I use (Using Visual Basic 6) is this the way to do >it. >> >Error in the Book? Bug in VB? Something else? >> > >> >Thanks, >> > >> >Sjoerd >> > >> >> >> Dim frm as frmMDIMain >> >> '-- Load an instance of the MDI form >> set frm = New FrmMDIMain >> frm.Show >> '-- Causes another instance of the MDI to load >> frmMDIMain.Caption = "Ooops" >> '-- Does not cause another instance to load >> frm.Caption = "Correct' >> >> J >> >> >> -- >> So I said "Do you want a game of Darts?", he said "OK then", I said >> "Nearest to bull starts". He said "Baa", I said "Moo", he said >> "You're closest". >> >> [Abolish the TV Licence - http://www.tvlicensing.biz/] >> > >Can't get your solution working. It gave me the idea to create a new >"normal" form (form2) and declare the variables on this form. Then load >form2 in form1 when form1 is loaded and showed. This solution works. Keep >wondering why declaring in frmMain generates the error. > >Sjoerd That's because it's not a solution. It's a demonstration of the problem. The solution I leave to you :-) J -- A good pun is itοΏ½s own reword. [Abolish the TV Licence - http://www.tvlicensing.biz/]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads