Create a Form with the Vb code

I have a form1 in which i have created a button , when u click the button in form1 it should generate a form2 getting few parameter from form1 and do few claculations .Apart from these the form2 also has two buttons ,few standard data and decorations.I need to create this form by writing Vb script .Since i've just started vb can anyone help me to proceed with this issue.
Thanks in Advance
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

you can create new forms by using "new" keyword. as follows:

dim frm2
set frm2=new form1
'you can use tag to distinguish form2 from form1 because the outlook and behavior of form2 is exactly same as form1

'show the newly created form

then in any sub, respond according to the tag value, e.g:

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
if me.tag="form2" then
  'execute code for form2
  'execute code for form1
end if

good luck!
you cited you need to use VBSCRIPT... but i assume you just mean VB code...

' ************ in form1 *****************
Private Sub Command1_Click

  'we will write in Caption of Form2 the sum of the passed parameters

  Dim frm as new Form2
  Dim i as Integer, j as Integer

  frm.Show vbModal

  set frm = nothing
End Sub

'******************in form2 **************

Public Sub A_Setup(Num1 as Integer, Num2 as Integer)

  Me.Caption = Cstr(Num1 + Num2)

end Sub

In Vb You Want To Do Some Calcualtions in Form2 also, then There Is No Way Using the Above Comments. So In Design Time Itself You Just add One More Form. By default its Name is Form2.

Write Function in Form2 as Follows,
Function cal(i As Integer)
    MsgBox i
End Function

assume u have coomand1 in Form1

public sub command1_click()
   call cal(10)
end sub

I Hope This will be HelpFul

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

So you want to pass variables between forms...

I tried earlnoli's code ,.. couldn't get it to work...

the only way I've been able to do it is by loading
controls within form one with the data you want to preserve and then loading the new form modally (I think)  
and getting the values from the still open form.

form1, form2



This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
vb_7, an EE Moderator will handle this for you.
Moderator, my recommended disposition is:

    Save as PAQ -- No Refund.

DanRollins -- EE database cleanup volunteer
PAQed - no points refunded (of 50)

E-E Admin

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.