Page 1 of 1

form creation

Posted: Wed Apr 09, 2003 9:21 am
by nuno_silva_pt
Hi again!
I'm having a witle problem:
I'm seen some were that you can make something like:
dim nf as new form1
and if you put in the cmd1 event:
nf
then it creates a new form
BUT
When i do it it says:
Compile error: (something more)
how can i do this the right way??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ???

Re:form creation

Posted: Wed Apr 09, 2003 10:13 am
by Tim
What language are you using? What error do you see?

Re:form creation

Posted: Thu Apr 10, 2003 2:23 am
by nuno_silva_pt
visual basic

Re:form creation

Posted: Thu Apr 10, 2003 8:47 pm
by smartguy240
Im sorry but you are going about this the worng way

GO ahead and make the form in Visual Basic and have it in your project set the visible property to false. Also if it asks for the startup form, say the form that you want to load *first* under Sub_Main

THEN
in the cmd1's click event have the code

Code: Select all

frm1.show
and you can also say

Code: Select all

Unload Me
to hide teh first form...(the form that the cmd1 is on)

hope i helped ya!

Re:form creation

Posted: Sat Apr 12, 2003 5:56 am
by nuno_silva_pt
that's not it!
i want my program to use a MDI form and "create" a duplicated form

Re:form creation

Posted: Sat Apr 12, 2003 3:20 pm
by smartguy240
ok give me a few minutes and ill test this out for you...i think that i knwo how to do this and it should be easy

Re:form creation

Posted: Sat Apr 12, 2003 3:26 pm
by smartguy240
ok not as easy as i thought...prehaps if you give me an example of what you are trying to do

i dont know if this is possible in VB because Forms dont have indexes...this means that a Load Object(Index) wont work...in other cases like in adding extra objects to a form....you would say for example

Code: Select all

Load cmdButton(intIndex)
to add another to the for but the origonal button has to have an index specified as 0 to keep it as the origonal

this might work too...just make the form and if you want the properties to be the same as the other form then go

Code: Select all

cmd2.Caption = frm1.cmd1.Caption
or something to that effect

so if you can give an example i can probabally give ya an answer ;)

Re:form creation

Posted: Sat Apr 12, 2003 8:34 pm
by meelWORM
Ok, first you want to create a MDI Form...
Project > Add MDI Form
name this frmMain

Then you want to create a MDI Child to open many copies from within the MDI Form(Parent)...
Just set the property of a normal form to MDIChild = True
name this frmSubTemplate

Now, you want to call many copies of this child...
In a Module, declare this:
Global frmSub(# of child's you want) as New frmSubTemplate

Then you can open new Child's like so:
frmSub(#).Show
It will open it as a Child of frmMain

Re:form creation

Posted: Sat Apr 12, 2003 9:00 pm
by smartguy240
yeah...he is right.... i knew about that...i just didnt know that that is what your problem was :-\

BTW: hey meelWORM...didnt know that you visited Mega Toyko!

Re:form creation

Posted: Sat Apr 12, 2003 10:56 pm
by meelWORM
SMG: I just registered today! ;D

Re:form creation

Posted: Sun Apr 13, 2003 4:03 am
by Eero Ränik
Welcome to Mega-Tokyo! ;)

Re:form creation

Posted: Sun Apr 13, 2003 7:29 am
by smartguy240
heheh thats great....the General Board is where i mostly hang out....but i also check the AGI board and this board *occasionally* to see if anyone needs any VB help ;)

Re:form creation

Posted: Sat May 10, 2003 11:07 am
by nuno_silva_pt
I finaly found what must i do!
you only write this:

Code: Select all

function newwindow()
dim nw as new formname
nw.show
end function
it works very well!