visual basic question

Discussion in 'Programmer's Corner' started by CaliusOptimus, Aug 12, 2007.

  1. CaliusOptimus

    Thread Starter Well-Known Member

    Aug 14, 2005
    im new to VB, so im just getting the hang of things. i havent been able to find a straight forward answer to my question on msdn or google, so thats why im here. ive been trying to change the value of txtBox.Size.Width (where txtBox is a toolstriptextbox) after a simple event such as a button click. ive tried things like:

    txtBox.Size.Width = 200



    and i just get an error message. any one here have any suggestions?

    EDIT: i solved the problem, the width value must be accessed outside of the size attribute ie:

    txtBox.Width = 200
  2. jpitz31

    Active Member

    Oct 24, 2007
    I found this out on the web.

    By default scrolling is disabled in text boxes and multiline is set to
    false. As such, the text box will only ever be 1 line. However if you
    enable scrolling and set multiline to true, you can calculate the size you
    will need to make the text box by fixing the font (type and size) and then
    calculating the box dimensions based on the string length. If you use the
    text changed event to do the calculation, the user will experience the box
    growing as they are typing.