School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!
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!



resizing text boxes

resizing text boxes title says all Rate Topic: -----

#1 paperclipmuffin  Icon User is offline

  • WinWinWinWindows?
  • Icon
  • View blog
  • Group: Authors
  • Posts: 910
  • Joined: 16-April 09


Dream Kudos: 400

Post icon  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! :ph34r:
Was This Post Helpful? 0
  • +
  • -


#2 firebolt  Icon User is offline

  • D.I.C Lover
  • Icon
  • View blog
  • Group: Author w/DIC++
  • Posts: 5,555
  • Joined: 20-February 09


Dream Kudos: 1675

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

Was This Post Helpful? 1
  • +
  • -

#3 ladyinblack  Icon User is offline

  • D.I.C Regular
  • Icon
  • View blog
  • Group: Authors
  • Posts: 353
  • Joined: 08-April 09


Dream Kudos: 275

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...
Was This Post Helpful? 0
  • +
  • -

#4 firebolt  Icon User is offline

  • D.I.C Lover
  • Icon
  • View blog
  • Group: Author w/DIC++
  • Posts: 5,555
  • Joined: 20-February 09


Dream Kudos: 1675

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.
Was This Post Helpful? 0
  • +
  • -

#5 ladyinblack  Icon User is offline

  • D.I.C Regular
  • Icon
  • View blog
  • Group: Authors
  • Posts: 353
  • Joined: 08-April 09


Dream Kudos: 275

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. :P
Was This Post Helpful? 0
  • +
  • -

#6 firebolt  Icon User is offline

  • D.I.C Lover
  • Icon
  • View blog
  • Group: Author w/DIC++
  • Posts: 5,555
  • Joined: 20-February 09


Dream Kudos: 1675

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

Was This Post Helpful? 0
  • +
  • -

#7 Zhalix  Icon User is offline

  • D.I.C Regular
  • PipPipPip
  • Group: Members
  • Posts: 260
  • Joined: 07-May 08


Dream Kudos: 0

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.
Was This Post Helpful? 0
  • +
  • -

#8 Raju2047  Icon User is offline

  • New D.I.C Head
  • Icon
  • 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
Was This Post Helpful? 0
  • +
  • -

#9 NoBrain  Icon User is online

  • D.I.C Lover
  • Icon
  • View blog
  • Group: Authors
  • Posts: 1,487
  • Joined: 25-March 09


Dream Kudos: 350

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
Was This Post Helpful? 0
  • +
  • -

#10 paperclipmuffin  Icon User is offline

  • WinWinWinWindows?
  • Icon
  • View blog
  • Group: Authors
  • Posts: 910
  • Joined: 16-April 09


Dream Kudos: 400

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


:rolleyes:
Was This Post Helpful? 0
  • +
  • -

#11 firebolt  Icon User is offline

  • D.I.C Lover
  • Icon
  • View blog
  • Group: Author w/DIC++
  • Posts: 5,555
  • Joined: 20-February 09


Dream Kudos: 1675

Posted 21 April 2009 - 05:45 PM

Thank you for reviewing.
Was This Post Helpful? 0
  • +
  • -



Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



Live Help!

Be Social

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

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month