|
Hey Everybody!
Well i need to display something like this on form:
15 + 10 = 10 + 5 + 10
now i tried gdi+ but i can't find a way to find out where like the 15 ended to start the + in another color so i thought the rich texy box would be easy'er but it seems it's been to long since i used it as well:
the code:
<br />
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
Dim varStart As Integer = 0<br />
<br />
rtBox.Text = "Hallo"<br />
rtBox.Select(varStart, Len(rtBox.Text))<br />
rtBox.SelectionColor = Color.Red<br />
rtBox.Refresh()<br />
<br />
MsgBox("Check 1")<br />
<br />
varStart = Len(rtBox.Text)<br />
<br />
rtBox.Text = rtBox.Text & " My Name Is "<br />
rtBox.Select(varStart, Len(rtBox.Text) - 1)<br />
rtBox.SelectionColor = Color.Black<br />
rtBox.Refresh()<br />
<br />
MsgBox("Check 2")<br />
<br />
varStart = Len(rtBox.Text)<br />
<br />
rtBox.Text = rtBox.Text & "BadBoyTazz"<br />
rtBox.Select(varStart, Len(rtBox.Text))<br />
rtBox.SelectionColor = Color.Red<br />
rtBox.Refresh()<br />
End Sub<br />
now the reason for the msgbox is just to force the pause of the code so that i can see how the rich text box refreshes! It does the same with or with out it!
What happens here is it writes the "Hallo" in red, then the " My Name " in Black & then it writes everything in RED after i add "BadBoyTazz"! What am i missing to get it to look like this: Hallo My Name Is BadBoyTazz
I can't see what the difference is between the first 2 words & when i add the "BadBoyTazz"
Thanx...
PS: If anybody can point me to a place where i can find the selution to the rich text box or gdi "version" please
-- modified at 6:52 Monday 29th January, 2007
I Live In My Own Little World! But It's Ok, They Know Me Here!
|
|
|
|
|
A while back I wrote some software to colour code a report that was displayed in an RTF box. Perhaps it will be of some use to you:
Private Sub Add_text_to_report(ByVal The_text As String, ByVal Style As System.Drawing.FontStyle, ByVal Colour As System.Drawing.Color)
Dim Font As New Font(rtBox.Font.FontFamily, rtBox.Font.Size, Style)
Dim Len As Integer = rtBox.Text.Length()
' Add the text
rtBox.AppendText(The_text)
' Now format it as specified
rtBox.SelectionStart = Len
rtBox.SelectionLength = The_text.Length
rtBox.SelectionFont = Font
rtBox.SelectionColor = Colour
' Clear the selection
rtBox.SelectionStart = 0
End Sub
Simply add this sub-routine into your form and whenever you want to add text to the RTF Box just call the routine, specifying the string to add, its format (i.e. bold, underline etc, and its colour)
Hope this helps,
Regards
Martin
|
|
|
|
|
Thanx will give it a try!
I see now what i missed "AppendText" just can't figure out why the example i've got works with out append but myne doesn't!
Thanx again!
I Live In My Own Little World! But It's Ok, They Know Me Here!
|
|
|
|
|
basically i'm not using VB.NET but an Access application with VBA code in it.
I posted in the vb.net forum as it's the nearest i can get to vba :P
my problem is :
i have a access database, and i want to export information into a MS Word file
this is to be done from access, as a button, that gathers data and makes a word file from it.
i have a working version, that uses a nicely written word file, with certain text named like "FIELD:01" etc.. and i have a button in my access application that (using vba) opens the word file (raw text) and does a string replace of the "FIELD:01" with the corresponding data.
The problem arises when the text to be replaced it either other than English, or funny characters (like the degrees celcius symbol)
Using mail merge features aren't good enough, because i want to insert 1 field of data, and not an entire table, and keeping formatting is important.
I've been playing around with other file formats to replace into, (such as htm, xml, rtf ..) but i still haven't found a solution that is good for both special characters and greek.
If this is posted in a terribly wrong place, please point me to the right direction.
Thank you for any help, it will be much appreciated.
Ericos Georgiades
|
|
|
|
|
i found a solution to my very own, confusing problem.
an article that was written for office 97!
http://support.microsoft.com/kb/131583[^]
posted the solution in case someone else has similar problems
Ericos Georgiades
|
|
|
|
|
Can someone answer this question for me.
Is the contains of this considered a type of collection?
textbox1.text
would like to use the FOR EACH on the text in the textbox1.text
|
|
|
|
|
Yes, a string is a collection. You can use for each to iterate over each char in the string.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
1).how i get a Processor id using vb..
and my another question is that...
2). how i can setup a project without creating a .exe fiel...
hi tahnks
|
|
|
|
|
You need WMI for that, which means you need to run as admin
Why would you need to not have an exe ? If you want to run code, you need to generate an exe.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
How I will Import / Export from/to Excel file ?
Annu
|
|
|
|
|
Probably by creating a CSV, that's the easiest way.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Thanks Christian,
then what is CSV ?
Annu Yadav
|
|
|
|
|
It stands for comma seperated values.
as, in, like, this
and, then, like, this
Excel can read them and write them
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi
Does anyone have a quick and simple bit of code for accessing the NTFS Access Control list of a file or directory?
Cheers
Andrew
|
|
|
|
|
how can i dynamically call a windows user control in a windows Form.
|
|
|
|
|
You mean add one ? Just create it, position it and add it to the form's controls collection.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
What's the best way to make an VB2005 application language independent so all the resources in it could be fast updatable to the targeted language: a separate dll, an xml file, ...?
Thanks in advance,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
Just use the build in support (resx files which will compile into satalite DLLs). If it is a small home project you can use a custom XML format as well though I can't see why you would possible want to do that.
If you plan to use professionel translation services, it is vital you stick to the standard formats so no custom preprocessing/postprocessing of your file format is required.
|
|
|
|
|
I'm trying to do it with the satellite DLLs but I can't find it. I've added strings in the Resources but after building the application I can't locate the satellite dll.
Is there something else that is needed?
Thanks again,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
Found. I needed to define the language for the form.
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
I've done my program and i make the installing file but customer need to run it in Window98 OS
which packing software i should use i don't know
thank you.
SWD
|
|
|
|
|
What is it written in ? .NET 2.0 doesn't work under 98. I believe .NET 1.1 requires W98 SE.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
At least you should install the Framework you've used. Any install packaging software should permit it but IMO one of the best, tiny and opensource is InnoSetup and ISTool[^]
Hope it helps !!!
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
Hi,
How i can disable right click in web browser in vb.net project
please give me an idea if any one have
Thanks,
Bye
|
|
|
|
|
It has nothing to do with VB.NET, the only code that runs on a browser is javascript. It's annoying when sites do it, but if you google, you're bound to find examples of jscript code for killing right click.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|