Results 1 to 5 of 5

Thread: [RESOLVED] color - formargb

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Location
    Kolkata, India
    Posts
    290

    Resolved [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

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,416

    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:
    1. .fromARGB(255,255,255,255)

    or:

    vb Code:
    1. .fromARGB(255,255,255)

    try:

    vb Code:
    1. lblMessage.ForeColor = directcast(ds.Tables("Events").Rows(MNo).Item("Color"),color)

  3. #3
    Addicted Member
    Join Date
    Feb 2008
    Location
    XP & Vista
    Posts
    181

    Re: color - formargb

    look the below thread same error fixed:
    Code:
    http://www.vbforums.com/showthread.php?t=499925
    _____________________________________________
    Regrads,
    kpmsivachand

    Don't walk in front of me, I may not follow; Don't walk behind me, I may not lead;
    Walk beside me, and just be my friend.

    Need Reviews: 1. PDF Split, PDF Merge, PDF Encrypt, PDF Decrypt and PDF Watermark

    Need Reviews: 2. Folder Locker | Lock Folder | File Locker | Locker | Encrryption | Encrypt

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Location
    Kolkata, India
    Posts
    290

    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.

  5. #5
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    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
  •  



Click Here to Expand Forum to Full Width