Results 1 to 5 of 5

Thread: [2005] Textbox resize

  1. #1

    Thread Starter
    Hyperactive Member FireKnox101's Avatar
    Join Date
    Aug 2005
    Location
    Snohomish,Washington
    Posts
    301

    Question [2005] Textbox resize

    On my form i have a multiline textbox named "txteditor", here is my problem when i hit then maximize button the textbox dosent change size? here is the code im using.

    VB Code:
    1. txteditor.width = me.width
    2. txtedirot.height = me.height

    Im using vb.net 2005 express

    Im currently using: VB.NET 2003, And VB 2005 Express
    My Projects
    Form Them Show Keypress In App
    Simple Ping Control

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Textbox resize

    You would normally set the Anchor property of the TextBox in the designer. That way you can specify any edge or combination of edges from which the control will maintain a constant distance. As the form grows or shrinks, so too the control will grow or shrink to maintain those constant distances. You also have the Dock property if you want the control hard up against an edge or to fill the parent control. If you want more complex layout control than that then you may find you need to use a TableLayoutPanel or FlowLayoutPanel. The VB Express video series (see my signature for a link) has an episode for each.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: [2005] Textbox resize

    Quote Originally Posted by FireKnox101
    On my form i have a multiline textbox named "txteditor", here is my problem when i hit then maximize button the textbox dosent change size? here is the code im using.

    VB Code:
    1. txteditor.width = me.width
    2. txtedirot.height = me.height

    Im using vb.net 2005 express
    Hi,

    I should do it this way;

    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         txtedirot.Size = New Size(500, 50)
    3.     End Sub
    4.  
    5.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    6.         txtedirot.Size = New Size(50, 250)
    7.     End Sub

    You must set the Multiline = true for your Textbox

    Hope it helps,

    sparrow1
    Last edited by sparrow1; Jul 5th, 2006 at 10:01 AM.
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Textbox resize

    Quote Originally Posted by sparrow1
    You must set the Multiline = true for your Textbox
    That's also a relatively important point.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2005] Textbox resize

    based on the code provided by the original poster.. this sounds like the textbox should have its dock property set to fill, and that should give the desired result.

    I am just basing that on the fact that their code implies making the textbox the same size as the form....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width