Dim as new

if in sub A i say

sub a ()
 dim x as new form1
end sub

then how can i do something with this new form x in a differnet sub... like

sub b()
 x.caption="Changed it"
end sub
hessAsked:
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.

PiNCommented:
Here's an example for what you are trying to do...what you tried above won't work because x is local.

Private MyNewForm As Form2

Private Sub a()
    Set MyNewForm = New Form2
End Sub

Private Sub b()
    MyNewForm.Caption = "Hello"
    MyNewForm.Show
End Sub
0
hessAuthor Commented:
but i need to make lots of x's. one everytime a button is clicked on. i think i'm on the right track now
0
PiNCommented:
a) works anyway
b) state your questions clearly before wasting other peoples time
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

hessAuthor Commented:
ooh... all bitched up... i gave you the parameters... you changed them. i said that sub a declared the new form. anyway i found my own solution. i would have just given your comment credit as the answer but it's pretty bitch...
0
hessAuthor Commented:
i didn't see that you were proposing the same answer that i just rejected.
0
hessAuthor Commented:
pin?... pinhead
0
hessAuthor Commented:
??? pin-penis??
0
PiNCommented:
You must be some 13-years-old lamer...still I sort of like your humour. Insulting is always funny, isn't it, dickhead ?
0
VbmasterCommented:
Declare a array and a variable as public (in a module)..

  Public NewForms() As Form1
  Public NewFormsCount As Long

Then whenever you want to create a new form use code like

  NewFormsCount = NewFormsCount + 1
  ReDim Preserve NewForms(NewFormsCount)
  Set NewForms(NewFormsCount) = New Form1
  NewForms(NewFormsCount).Visible = True

Is this what you were looking for??
0

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
hessAuthor Commented:
i did something. like that and it worked. i used and array of 100 objects... your's looks good i'll take it... sorry pin head... that was fun. i'm seventeen and you're obviously young too. you used the word lamer...
0
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.