iNET Interactive - Online Advertising Agency
          
Go Back  Xtreme .NET Talk > .NET > Windows Forms > change form1 control on form2


Reply
 
Thread Tools Display Modes
  #1  
Old 02-05-2003, 05:57 PM
sethindeed's Avatar
sethindeed sethindeed is offline
Centurion
 
Join Date: Dec 1969
Location: Montreal Canada
Posts: 118
Question change form1 control on form2

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 ?
__________________
What I don't know keeps me excited...
Reply With Quote
  #2  
Old 02-05-2003, 06:27 PM
quwiltw quwiltw is offline
Contributor
 
Join Date: Sep 2001
Location: Washington, D.C.
Posts: 486
Default

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 it's public size property directly
f.Size = New Size(200, 200)
__________________
--tim

Last edited by quwiltw : 02-05-2003 at 06:33 PM.
Reply With Quote
  #3  
Old 02-05-2003, 07:05 PM
sethindeed's Avatar
sethindeed sethindeed is offline
Centurion
 
Join Date: Dec 1969
Location: Montreal Canada
Posts: 118
Default

There is certainly something I don't 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 !
__________________
What I don't know keeps me excited...
Reply With Quote
  #4  
Old 02-05-2003, 07:09 PM
quwiltw quwiltw is offline
Contributor
 
Join Date: Sep 2001
Location: Washington, D.C.
Posts: 486
Default

I suspect scoping issues have gotten the best of you see if my last post to this guy helps.
http://www.dotnetforums.net/showthre...threadid=49478
hurry up if not because I'm about to leave work
__________________
--tim
Reply With Quote
  #5  
Old 02-05-2003, 07:13 PM
sethindeed's Avatar
sethindeed sethindeed is offline
Centurion
 
Join Date: Dec 1969
Location: Montreal Canada
Posts: 118
Default

Actually, they are declared in 2 different scopes.
DO you have a quick example of control manipulation within forms ?
thx
__________________
What I don't know keeps me excited...
Reply With Quote
  #6  
Old 02-05-2003, 07:13 PM
quwiltw quwiltw is offline
Contributor
 
Join Date: Sep 2001
Location: Washington, D.C.
Posts: 486
Default

Pls post the relevant code for showing frm.
__________________
--tim
Reply With Quote
  #7  
Old 02-05-2003, 07:15 PM
quwiltw quwiltw is offline
Contributor
 
Join Date: Sep 2001
Location: Washington, D.C.
Posts: 486
Default

Quote:
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 can't be inside the subroutine itself. Who knows perhaps my suspicions were wrong but it'd be easier to diagnose if I could see the relevant code.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
form2.show , close form1, form2 still active PROKA Windows Forms 4 05-07-2004 11:23 AM
[VB.NET] Form1 & Form2 hobbes2103 Windows Forms 4 07-11-2003 04:10 AM
Form1 & Form2 maxpic55 Windows Forms 5 07-08-2003 04:58 AM
Form2 location in relation to Form1 DiverDan Windows Forms 1 01-22-2003 05:49 PM
Put a string from Form2 to Form1(mainform) cube Windows Forms 1 11-08-2002 11:41 PM

Advertisement: