473,503 Members | 1,888 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Value of type ......

: 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
1 1596
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
14124
by: G Kannan | last post by:
Hey all! I have written a perl script to retrieve information from a HTML Form and insert the data into an Oracle database table. I am gettting the the following error message: "Use of...
16
11462
by: cwizard | last post by:
I'm calling on a function from within this form, and there are values set but every time it gets called I get slammed with a run time error... document.frmKitAmount.txtTotalKitValue is null or not...
21
3930
by: Michael Bierman | last post by:
Please forgive the simplicy of this question. I have the following code which attempts to determine the color of some text and set other text to match that color. It works fine in Firefox, but does...
13
10087
by: dbuchanan | last post by:
Hello, Here is the error message; ---------------------------- Exception Message: ForeignKeyConstraint Lkp_tbl040Cmpt_lkp302SensorType requires the child key values (5) to exist in the...
1
4067
by: sourcie | last post by:
I am changing an existing quiz found on "JavaScriptKit.com Multiple Choice Quiz" I have an image. Instead of using the radio buttons with the normal true/false question, I want to place two...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7348
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7006
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5021
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4685
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3166
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1519
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
397
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.