|
-
Feb 14th, 2010, 01:54 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] color - formargb
Hi,
warinng message :-
Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
syntax:
lblMessage.ForeColor = Me.f_Color.FromArgb(ds.Tables("Events").Rows(MNo).Item("Color"))
Guide what wrong with syntax?
asm
-
Feb 14th, 2010, 02:49 AM
#2
Re: color - formargb
what is the exact value of ds.Tables("Events").Rows(MNo).Item("Color")?
.fromARGB expects 3 or 4 numbers, i.e,
vb Code:
.fromARGB(255,255,255,255)
or:
try:
vb Code:
lblMessage.ForeColor = directcast(ds.Tables("Events").Rows(MNo).Item("Color"),color)
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Feb 14th, 2010, 02:52 AM
#3
Addicted Member
Re: color - formargb
look the below thread same error fixed:
Code:
http://www.vbforums.com/showthread.php?t=499925
-
Feb 26th, 2010, 02:25 AM
#4
Thread Starter
Hyperactive Member
Re: color - formargb
let us explain my problem:
Dim f_Color As System.Drawing.Color
store numeric color value->
lblColor.text = f_Color.ToArgb
and display the color into label-
lblMessage.ForeColor = Me.f_Color.FromArgb(ds.Tables("Events").Rows(MNo).Item("Color"))
warning message show:
Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
-
Feb 26th, 2010, 08:35 AM
#5
Re: color - formargb
The function System.Drawing.Color.FromArgb is a shared method, but you're accessing it from an instance of your form. This line:
Code:
lblMessage.ForeColor = Me.f_Color.FromArgb(ds.Tables("Events").Rows(MNo).Item("Color")
Needs to be changed to this:
Code:
lblMessage.ForeColor = System.Drawing.Color.FromArgb(CInt(ds.Tables("Events").Rows(MNo).Item("Color")))
By the way, you should turn Option Strict ON.
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|