By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,552 Members | 893 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,552 IT Pros & Developers. It's quick & easy.

Value of type ......

P: n/a
: error BC30311: Value of type 'System.Drawing.Color' cannot be
converted to 'Integer'.

Function doColor(ByVal rtb As RichTextBox, ByVal a As String, Optional
ByVal f As Integer = 0, Optional ByVal bg As Integer = 0)
Dim b As String, n, fgcolor, bgcolor As Integer

Dim colour(15) As Color
colour(0) = Color.White
colour(1) = Color.Black
colour(2) = Color.DarkBlue
colour(3) = Color.DarkGreen 'dark green
colour(4) = Color.Red 'red
colour(5) = Color.Brown
colour(6) = Color.Purple
colour(7) = Color.Orange
colour(8) = Color.Yellow
colour(9) = Color.LightGreen 'light green
colour(10) = Color.DarkMagenta 'dark blue green
colour(11) = Color.SkyBlue
colour(12) = Color.Blue 'light blue
colour(13) = Color.Magenta 'magenta
colour(14) = Color.Gray
colour(15) = Color.LightSlateGray

..
..
.. f = ColorTranslator.ToWin32(colour(fgcolor))
rtb.backcolour = colour(bgcolor) ===> error
occured here
APIHighlight2(bg, colour(fgcolor))
Debug.WriteLine(fgcolor)
...
..
..
..
..
End Function

how do i convert colour(bgcolor) into rtb.backcolor. this is irc chat
colour similar to mirc. it will worked in vb6. i tried this:...
ColorTranslator.ToWin32
color.fromArg
color.fromknowcolor
ColorTranslator.ToOle
directcast
ctype

regards,

Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Supra,

Is your rtb a user control?
Because you use rtb.colour

This does give me a normal richtextbox with any color as background that I
choose:
Dim colour(15) As Color
colour(0) = Color.White
colour(1) = Color.Black
colour(2) = Color.DarkBlue
colour(3) = Color.DarkGreen 'dark green
colour(4) = Color.Red 'red
colour(5) = Color.Brown
colour(6) = Color.Purple
colour(7) = Color.Orange
colour(8) = Color.Yellow
colour(9) = Color.LightGreen 'light green
colour(10) = Color.DarkMagenta 'dark blue green
colour(11) = Color.SkyBlue
colour(12) = Color.Blue 'light blue
colour(13) = Color.Magenta 'magenta
colour(14) = Color.Gray
colour(15) = Color.LightSlateGray
rtb.backcolor = colour(5)

I hope this helps?

Cor
Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.