VB School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a VB Expert!

Join 300,336 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,657 people online right now. Registration is fast and FREE... Join Now!




resizing text boxes

 

resizing text boxes, title says all

paperclipmuffin

20 Apr, 2009 - 11:18 PM
Post #1

WinWinWinWindows?
Group Icon

Joined: 16 Apr, 2009
Posts: 881



Thanked: 9 times
Dream Kudos: 400
My Contributions
Hi all.

Very simple but illusive question for you. I have a MDI child form with one fullscreen textbox

I have this code:
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! ph34r.gif

User is offlineProfile CardPM
+Quote Post


firebolt

RE: Resizing Text Boxes

20 Apr, 2009 - 11:24 PM
Post #2

D.I.C Lover
Group Icon

Joined: 20 Feb, 2009
Posts: 5,462



Thanked: 75 times
Dream Kudos: 1675
My Contributions
The name should just be "Form" in the first line.

CODE

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! happy.gif

This post has been edited by firebolt: 21 Apr, 2009 - 01:56 AM
User is offlineProfile CardPM
+Quote Post

ladyinblack

RE: Resizing Text Boxes

21 Apr, 2009 - 12:40 AM
Post #3

D.I.C Regular
Group Icon

Joined: 8 Apr, 2009
Posts: 317



Thanked: 7 times
Dream Kudos: 25
My Contributions
@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...
User is offlineProfile CardPM
+Quote Post

firebolt

RE: Resizing Text Boxes

21 Apr, 2009 - 01:36 AM
Post #4

D.I.C Lover
Group Icon

Joined: 20 Feb, 2009
Posts: 5,462



Thanked: 75 times
Dream Kudos: 1675
My Contributions
@ladyinblack.
Are you sure. Just test this. Double click the blank form and what does the code say. Does it say:
CODE

Private Sub Form_Load()

End Sub

OR:
CODE

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.
User is offlineProfile CardPM
+Quote Post

ladyinblack

RE: Resizing Text Boxes

21 Apr, 2009 - 01:51 AM
Post #5

D.I.C Regular
Group Icon

Joined: 8 Apr, 2009
Posts: 317



Thanked: 7 times
Dream Kudos: 25
My Contributions
@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. tongue.gif
User is offlineProfile CardPM
+Quote Post

firebolt

RE: Resizing Text Boxes

21 Apr, 2009 - 01:53 AM
Post #6

D.I.C Lover
Group Icon

Joined: 20 Feb, 2009
Posts: 5,462



Thanked: 75 times
Dream Kudos: 1675
My Contributions
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 Apr, 2009 - 01:54 AM
User is offlineProfile CardPM
+Quote Post

Zhalix

RE: Resizing Text Boxes

21 Apr, 2009 - 01:54 AM
Post #7

D.I.C Regular
***

Joined: 7 May, 2008
Posts: 259



Thanked: 19 times
My Contributions
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.
User is offlineProfile CardPM
+Quote Post

Raju2047

RE: Resizing Text Boxes

21 Apr, 2009 - 06:56 AM
Post #8

New D.I.C Head
Group Icon

Joined: 16 Feb, 2009
Posts: 45



Thanked: 5 times
Dream Kudos: 25
My Contributions
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
User is offlineProfile CardPM
+Quote Post

NoBrain

RE: Resizing Text Boxes

21 Apr, 2009 - 09:02 AM
Post #9

D.I.C Lover
Group Icon

Joined: 25 Mar, 2009
Posts: 1,152



Thanked: 33 times
Dream Kudos: 125
My Contributions
dude Form_Resize() mean like curent FORM RESIZE not like form200019887_resize() just like the (curent) form_resize() the form that your using
User is offlineProfile CardPM
+Quote Post

paperclipmuffin

RE: Resizing Text Boxes

21 Apr, 2009 - 05:00 PM
Post #10

WinWinWinWindows?
Group Icon

Joined: 16 Apr, 2009
Posts: 881



Thanked: 9 times
Dream Kudos: 400
My Contributions
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:
CODE

Private Sub form_resize()
Text1.Height = Form1.Height
Text1.Width = Form1.Width
End Sub

rolleyes.gif
User is offlineProfile CardPM
+Quote Post

firebolt

RE: Resizing Text Boxes

21 Apr, 2009 - 05:45 PM
Post #11

D.I.C Lover
Group Icon

Joined: 20 Feb, 2009
Posts: 5,462



Thanked: 75 times
Dream Kudos: 1675
My Contributions
Thank you for reviewing.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/7/09 05:09PM

Live VB Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month