none
single line textbox height... RRS feed

  • Question

  • is that possible to change the height of single line textbox, without changing the font size or change textbox mode to multiline, because I was working on POS software that requires a certain size?
    Sunday, May 29, 2011 8:54 AM

Answers

All replies

  • is that possible to change the height of single line textbox, without changing the font size or change textbox mode to multiline, because I was working on POS software that requires a certain size?


    Hello rahmat,

     

    If you want to change the height value necessariamante make multiline, otherwise you can just change the width.

    Hello


    Carmelo La Monica  http://community.visual-basic.it/carmelolamonica/
    Sunday, May 29, 2011 9:03 AM
  • Sure, you have to change the Height property and set the MultiLine property to true:

     textBox1.Multiline = true;
     textBox1.Height = 50;
    


    Mitja

    Sunday, May 29, 2011 9:05 AM
  • Rahmat,

    Why are you are busy with a POS application are you still using Windows Forms instead of WPF

    http://msdn.microsoft.com/en-us/library/ms754130.aspx


    Success
    Cor
    Sunday, May 29, 2011 9:32 AM
  • in multiline mode, the text can't be displayed in the middle of the textbox (for the first line), I hope you can help me. thanks

     

    Rahmat

    Sunday, May 29, 2011 10:10 AM
  • in multiline mode, the text can't be displayed in the middle of the textbox (for the first line), I hope you can help me. thanks

     

    Rahmat

    Sunday, May 29, 2011 10:11 AM
  • in multiline mode, the text can't be displayed in the middle of the textbox (for the first line), I hope you can help me. thanks

     

    Rahmat


    Hello rahmath.p,

    with the textbox control is not possible to align the center the first line of text in code, you must use a RichTextBox, that unlike you permatte textbox control text formatting and many other body features.
    For more information http://msdn.microsoft.com/en-us/library/system.windows.forms.richtextbox(v=VS.80).aspx

    Here one sample:

     

       richTextBox1.Height = 40;
    
       if (richTextBox1.SelectedText != string.Empty)
       {
       richTextBox1.SelectionAlignment = HorizontalAlignment.Center;
       }
    

     

    Hello


    Carmelo La Monica  http://community.visual-basic.it/carmelolamonica/
    • Proposed as answer by Helen Zhou Monday, May 30, 2011 3:07 AM
    • Marked as answer by rahmat.p Monday, May 30, 2011 3:08 PM
    Sunday, May 29, 2011 10:24 AM
  • in multiline mode, the text can't be displayed in the middle of the textbox (for the first line), I hope you can help me. thanks

    No, sorry.

    Carmelo explained well why not. And he proposed you which control to use instead to get the same results.


    Mitja

    Sunday, May 29, 2011 11:03 AM