What's Here?
- Members: 340,149
- Replies: 920,517
- Topics: 154,948
- Snippets: 4,855
- Tutorials: 1,257
- Total Online: 3,872
- Members: 120
- Guests: 3,752
|
Welcome to Dream.In.Code |
|
|
Become an Expert!
Join 340,149 Programmers for FREE! Get instant access to thousands  of experts, tutorials, code snippets, and more! There are 3,872 people online right now. Registration is fast and FREE... Join Now!
Chat LIVE With a Expert
|
resizing text boxes
resizing text boxes
title says all
Rate Topic:
   
Posted 20 April 2009 - 11:18 PM
Hi all.
Very simple but illusive question for you. I have a MDI child form with one fullscreen textbox
I have this code:
Private Sub Form1_resize()
Text1.Height = Form1.Height
Text1.Width = Form1.Width
end sub
When I run it resizes text1 correctly in height, but width never changes.
Help please!
Posted 20 April 2009 - 11:24 PM
The name should just be "Form" in the first line.
Private Sub Form_Resize()
Text1.Height = Form1.Height
Text1.Width = Form1.Width
End Sub
NOTE: Only change the first line. The rest is fine.
Now Thank me by clicking the link below!
This post has been edited by firebolt: 21 April 2009 - 01:56 AM
Posted 21 April 2009 - 12:40 AM
@firebolt - by no means am I insulting your intelligence, but your suggestion is wrong. Since I've checked now on vb6, the automatic form naming is Form1.
@paperclip, the thing is you only finding the height adjusted and the width going beyond the form, I'm assuming that what happened. Try moving your textbox to location [0,0] on the form, and it should work as you had wanted.
I would have been the first to reply, but firebolt beat me and my computer is having one of its bad moments...
Posted 21 April 2009 - 01:36 AM
@ladyinblack.
Are you sure. Just test this. Double click the blank form and what does the code say. Does it say:
Private Sub Form_Load()
End Sub
OR:
Private Sub Form1_Load()
End Sub
Please let me know.
Yes, the automatic name of the form is Form1 but VB syntax is just Form.
Posted 21 April 2009 - 01:51 AM
@firebolt, indeed it does say so on the method name (I don't know what its called in VB)
But, I tested paperclip's code before replying and I also tested your suggestion, Form.Height did not work, then tested Form1.Height (100%). In properties, the name of the Form, says Form1. Plus you know VB6 has that popup menu that just comes up whenever you press the (.) key for some function you wish to choose, in this instance .Height or .Width. Did not work with Form. And yes, the program ran with out any errors. Your (Form.) gave errors.
Posted 21 April 2009 - 01:53 AM
No, I meant only the first line, we change the Form1 into Form.
Please re-read my code carefully as I did not change anything else but that first line.
Thanks.
This post has been edited by firebolt: 21 April 2009 - 01:54 AM
Posted 21 April 2009 - 01:54 AM
Ladyinblack, by no means am I insulting your intelligence, but there's a difference between form events and form properties and actions.
Form_Event() is how form events look.
FormName.Property is how you deal with properties and actions.

- New D.I.C Head
-
-
Group:
Contributors
-
Posts:
45
-
Joined:
16-February 09
Dream Kudos: 25
Posted 21 April 2009 - 06:56 AM
There's nothing wrong in the error. it should changes. but as you have not located the left, and top properties for text1, there could be some error
Posted 21 April 2009 - 09:02 AM
dude Form_Resize() mean like curent FORM RESIZE not like form200019887_resize() just like the (curent) form_resize() the form that your using
Posted 21 April 2009 - 05:00 PM
Whoa. I didn't want to stir up such a commotion. But the correct code turned out to be (after looking at all these posts)this:
Private Sub form_resize()
Text1.Height = Form1.Height
Text1.Width = Form1.Width
End Sub
Posted 21 April 2009 - 05:45 PM
Thank you for reviewing.
1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users
|
Be Social
Programming
Web Development
Reference Sheets
Bye Bye Ads
Monthly Drawing
Top Contributors
Top 10 Kudos This Month
|