I'm looking for a way to format a string. Is there a way to format a string that will be shown in a textbox?
Here's what I want to do.
Code:
Dim strName As String
strName = "Company Name:" & vbCrLf & _
"University of Winsconsin Stout" & vbCrLf vbCrLf & _
"Department:" & vbCrLf & _
"Development"
txtbox1.text = strName
In the above code, I want to bold the heading "Company Name:" and "Department:" and then italicize the "University of Wincosin Stout" and "Development".
By the way, Pirate, do you know a way to write the texts to a textbox or richtextbox in design time? I want to write the About and Help section of my application in design mode, but I couldn't find an easier way to do it.
Perhaps textbox won't do it but richtextbox will retain my format such as bold, italics, tab, and things of that nature if a load the file in run time, right?
One other question. I know this can be done but I don't know how to do it. When I load the RTF file from the directory, how do I read the information in that file? For example, I have topics such as Introduction, Updating, Inserting, Deleting. When the user click on the Updating topic, how do I load just the Updating section into my richtextbox from the file and kept the rest from loading into the richtextbox? I know that I would have to format my RTF file in such a way that there is a unique charactor before the next topic section start...but I don't know how to read from the file and determine that unique charactor to start and stop loading into the textbox.
Sorry for asking too much of you, but I really do need help.
I gave your sample a try and it does pretty much what I wanted to do; however, I couldn't get each section to load individually. Every time when I want to load, let's say, Deleteing section, the Introduction section and any section that is above the Deleting section will also appear in the richtextbox. Is there a way to fix this problem? Right now the problem is that all section that is before the specify section appear in the rtf box and I only want the section that I choose to load.