Results 1 to 7 of 7

Thread: [RESOLVED] vb window resizing

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2005
    Posts
    15

    Resolved [RESOLVED] vb window resizing

    Hi all

    im trying to figure out how to resize my list box
    What I have is a vb program when run and the apropriate data is inputed, calcualations are done and then are outputed to a listbox what i want to know is there a way to have the listbox resize when the main window is resized.


    Ed

  2. #2
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: vb window resizing

    take a look at this thread.........use the code specified by MartinLiss:
    Resize
    hope it shud help u!!! it will resize other controls (those which can be resized) on the object/form!!
    Show Appreciation. Rate Posts.

  3. #3
    Junior Member
    Join Date
    Sep 2005
    Posts
    24

    Re: vb window resizing

    Hi Edward
    Try following:
    go to the Event of Form_Paint() and write
    ListBox.Top = 10
    ListBox.Left = 10
    ListBox.Height = me.Height - 20
    ListBox.Width = me.Width - 20

    me is the Form itself and the Value of 20 must be adjusted for your Form.
    if you have a Scrollbar then is mayby 200 nice.

    Chris

  4. #4
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: vb window resizing

    Quote Originally Posted by Chris67
    Hi Edward
    Try following:
    go to the Event of Form_Paint() and write
    ListBox.Top = 10
    ListBox.Left = 10
    ListBox.Height = me.Height - 20
    ListBox.Width = me.Width - 20

    me is the Form itself and the Value of 20 must be adjusted for your Form.
    if you have a Scrollbar then is mayby 200 nice.

    Chris
    Chris!

    ur idea seems to be good except, if the size of the list box is small then there is a possibilty of control n the form to flicker!!!
    i hope i m correct, coz Paint event is generally avoided if u want to resize controls instancing on the object!!
    Show Appreciation. Rate Posts.

  5. #5
    Junior Member
    Join Date
    Sep 2005
    Posts
    24

    Re: [RESOLVED] vb window resizing

    yes, and just use 'on error resume next' statement to ignor all errors
    Chris

  6. #6
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: [RESOLVED] vb window resizing

    Quote Originally Posted by Chris67
    yes, and just use 'on error resume next' statement to ignor all errors
    Chris
    are u replying to my post???? i m not saying any error occurred in your method!!
    but if u use a larger value instead of 20, then the form n the contained controls will flicker!!

    PS - maybe i m wrong..........i m saying coz this is a common problem with Paint event!!
    Show Appreciation. Rate Posts.

  7. #7
    Junior Member
    Join Date
    Sep 2005
    Posts
    24

    Re: [RESOLVED] vb window resizing

    I'm not sure if the flicker an coz problem but if you play with the Values you get a better result, 20 was just a example.
    The Error handle must be integrated because if you minimized the Form you get errors.
    Chris

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