4 Replies - 498 Views - Last Post: 06 October 2012 - 07:15 AM Rate Topic: -----

#1 EntIam  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 04-October 12

Question, Is it possible to have only a header in a textbox bold?

Posted 05 October 2012 - 07:41 PM

I have what I can only call a header in a text box. I wanted to see if I could bold and underline the column header while still having the rest of the text input not bold or underlined. I understand I would have to use a rich text box to be able to do formatting in this way period. The code for the header is
 Dim strTxtHeader As String = strItem.PadLeft(25) & strQuantity.PadLeft(35) & strPrice.PadLeft(15) & strSubTotal.PadLeft(15) & ControlChars.NewLine


I currently have that going into a regular text box in the form load event with this code
 txtOutPut.Text = strTxtHeader


Is there a easy way to make each variable in the text header bold and underlined? I have not done any formatting in a rich text box yet. I am guessing this is easy to do but going over my head at the moment.

Is This A Good Question/Topic? 0
  • +

Replies To: Question, Is it possible to have only a header in a textbox bold?

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 8937
  • View blog
  • Posts: 33,463
  • Joined: 12-June 08

Re: Question, Is it possible to have only a header in a textbox bold?

Posted 05 October 2012 - 07:47 PM

Why not make a custom user control.. with a label docked to the top.. the textbox below set to fill.. and the label colored like a textbox? Slap a few properties to input/change text and off you go.
Was This Post Helpful? 1
  • +
  • -

#3 DimitriV  Icon User is offline

  • They don't think it be like it is, but it do
  • member icon

Reputation: 583
  • View blog
  • Posts: 2,738
  • Joined: 24-July 11

Re: Question, Is it possible to have only a header in a textbox bold?

Posted 05 October 2012 - 07:52 PM

The TextBox, as far as I know, only supports one font at once. The RichTextBox isn't really that hard to use though:
Just read up about RichTextBox.SelectionFont, it's pretty easy. (http://msdn.microsoft.com/en-us/library/system.windows.forms.richtextbox.selectionfont.aspx#Y15)

View Postmodi123_1, on 06 October 2012 - 01:47 PM, said:

Why not make a custom user control.. with a label docked to the top.. the textbox below set to fill.. and the label colored like a textbox? Slap a few properties to input/change text and off you go.

If you're doing that just make the background transparent.
Was This Post Helpful? 1
  • +
  • -

#4 lar3ry  Icon User is offline

  • Coding Geezer
  • member icon

Reputation: 310
  • View blog
  • Posts: 1,290
  • Joined: 12-September 12

Re: Question, Is it possible to have only a header in a textbox bold?

Posted 05 October 2012 - 09:07 PM

View PostDimitriV, on 05 October 2012 - 07:52 PM, said:

If you're doing that just make the background transparent.

Not forgetting, of course, to start your TextBox entries with a NewLine.
Was This Post Helpful? 1
  • +
  • -

#5 EntIam  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 04-October 12

Re: Question, Is it possible to have only a header in a textbox bold?

Posted 06 October 2012 - 07:15 AM

Thank you for the tip. I will work on that. Seem exactly like what I need to do. I am glad there is a place where I can ask people with experience.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1