change form1 control on form2

sethindeed

Well-known member
Joined
Dec 31, 1969
Messages
118
Location
Montreal Canada
Hi all !
Was wondering...
How I can change Form1 properties ( such as text, height... ) from Form2.
I tried to do it like we do in vb.net for using procedures stored on another form ( delcaring variable as Form1 ) but it does not work

Any clues ?
 
You could add Friend methods on Form 1 like
Friend Function SetHeight(x as int)
and just call if from form2.

EDIT: Or you could just use its public size property directly:)
f.Size = New Size(200, 200)
 
Last edited by a moderator:
There is certainly something I dont understand...

Dim frm as new Form1

frm.setheight(200)

The code does not generates any error but they are no changes made on the hieght of the form.
I declared my function Public and Friend on Form1 with no results...Does this have something to do with NEW Keywork ?
I created Form2 from Form1 :

Dim frm as new Form2

frm.ShowDialog()

Is there any parameter I am missing ?
Please note that Form1 is an MDI Parent form and that form2 is a modal form used to log to the program ( username, password )

thx !
 
Originally posted by sethindeed
Actually, they are declared in 2 different scopes.
DO you have a quick example of control manipulation within forms ?
thx :)

Did you see in my other post how the declaration of the form is at the Class level. It cant be inside the subroutine itself. Who knows perhaps my suspicions were wrong but itd be easier to diagnose if I could see the relevant code.
 
Back
Top