Hi,
i would like to ask whether can i format the text in textbox in such a way that whenever there is a bullet, it will display it in a newline.
the textbox data is retrieve from a database in the same column.
Hi,
i would like to ask whether can i format the text in textbox in such a way that whenever there is a bullet, it will display it in a newline.
the textbox data is retrieve from a database in the same column.
text formating
Brian Westover
Something like this... I haven't tested it so it'll need some tweaking. And you'll need to find the char code for a bullet.
dim start as integer = 0
do while txtTextbox.text.indexof("bulletchar", start) >-1 andalso txtTextbox.text.lastindexof("bulletchar") <> txtTextbox.text.indexof("bulletchar", start)
txtTextbox.insert(start-1,Environment.Newline)
start=start+1
loop
Jeroen Bransen - J-Thread
Actually, sorry, there's a heaps more efficient way of doing this. I should switch my brain on.
txtDisplay1.text = txtDisplay1.text.replace("bulletchar","bulletchar" & environment.newline)
kiwishane
jannell
MattH6
Andriy Karasyov
AccTech
Chris_Bond
I am sorry to ask so many questions. I have include the code in my program. however, nothing happens to the output. Everything just looks the same as before.
May i know where should i include the code
dczyz
txtDisplay1.insert(start - 1, Environment.NewLine)
It says that textbox do not have insert property.
piip
Hi, sorry I wasn't clear. It should be:
Private Sub txtDisplay1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtDisplay1.TextChanged
txtDisplay1.Text = txtDisplay1.Text.Replace("."c, ". " & Environment.NewLine)
End SubYou also hadn't declared the characters correctly, as it would have been looking for a string "95". If you're using a full-stop now, it should work OK as above. However, you will want to be careful doing this in the text-changed event. What is it you're trying to do
SOHI
Mike_63
Is okay. DOnt't have to say sorry because i am shy. i am so new in vb.net and i have so many questions.
ok.. i will try to include the code in my program. By the way, thanks a lot.
Joy19101
It should be txtDisplay1.text.insert
And yes, replace bulletchar with the correct char value.
Darwinsmom
i have tried to use the codes but it doesn't work as well. is it my programing code got problem actually i could not find the ASCII code for bullet, therefore i use the code for fullstop. however, it does not work also. i attached my code for you to have a look.
Private Sub txtDisplay1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtDisplay1.TextChanged Dim start As Integer = 0 Do While txtDisplay1.Text.IndexOf("95", start) > -1 AndAlso txtDisplay1.Text.LastIndexOf("95") <> txtDisplay1.Text.IndexOf("95", start)txtDisplay1.Text = txtDisplay1.Text.Replace("95", "95" & Environment.NewLine)
start = start + 1
Loop End Sub