Results 1 to 5 of 5

Thread: Sticking together text box to form[RESOLVED]

  1. #1

    Thread Starter
    Addicted Member WilliamRobinson's Avatar
    Join Date
    Feb 2005
    Posts
    219

    Resolved Sticking together text box to form[RESOLVED]

    "Sticking Together" isnt the best phrase but i dont know what to call it but im making a kind of notepad basicly and i want to textbox to stick to the form so when the form is resized so is the textbox,, Look at MS Notepad for an example...

    Cheers
    Last edited by WilliamRobinson; Apr 18th, 2005 at 04:18 PM.
    Nothing is Impossible you say?......Try slamming a revolving door!

  2. #2
    Fanatic Member Blade's Avatar
    Join Date
    Jan 1999
    Location
    Stoke-on-Trent, UK
    Posts
    527

    Re: Sticking together text box to form

    In the Form_Resize event, simply resize the textbox to whatever size you need.

    Example: Create a new project and drop a textbox onto it then put this code in the form module:

    VB Code:
    1. Private Sub Form_Resize()
    2.     Text1.Move 0, 0, Me.Width - 90, Me.Height - 390
    3. End Sub

    Run the project and you'll see how the textbox resizes with the form.

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Sticking together text box to form

    In the Resize event of the form, change the height & width of the text box to match.... but be sure to check the WindowState property first.... make sure it isn't set to Minimize.

    Tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: Sticking together text box to form

    Well, you would have to resize the control using the Form_Resize sub... I used something like this in mine:

    VB Code:
    1. Private Sub Form_Resize()
    2.     On Error Resume Next
    3.     If frmMainForm.WindowState = vbMinimized Then
    4.         Exit Sub
    5.     Else
    6.         TextBox1.Top = 5
    7.         TextBox1.Left = 5
    8.         TextBox1.Height = (Me.ScaleHeight - 5)
    9.         TextBox1.Width = (Me.ScaleWidth - 5)
    10.     End If
    11. End Sub

    You could do something like that but, you'd need to tweek it a bit

    Cheers,

    RyanJ
    My Blog.

    Ryan Jones.

  5. #5

    Thread Starter
    Addicted Member WilliamRobinson's Avatar
    Join Date
    Feb 2005
    Posts
    219

    Re: Sticking together text box to form

    ACE!!
    Nothing is Impossible you say?......Try slamming a revolving door!

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