Results 1 to 3 of 3

Thread: A field initializer cannot reference the nonstatic field, method, or property..

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2011
    Posts
    3

    A field initializer cannot reference the nonstatic field, method, or property..

    Hi,

    I Working on Asp.net 2.0. I am declaring and initializing variables globally like this:-
    Code:
            double a1=0.0081;       
            double B3=12.61/100;
            double B4=B3-a1;
            double B5=B4-a1;
            double B6=B5-a1;
    
    double F8=Convert.ToDouble(TxtSqFeet.Text.ToString());
    		double F9=Convert.ToDouble(TxtLinealFeet.Text.ToString());			
    		double G6=Convert.ToDouble(TxtTravelTime.Text.ToString());
    		double G11=Convert.ToDouble(TxtLiners.Text.ToString());
    And find the following error:- A field initializer cannot reference the nonstatic field, method, or property..

    Second Error is TxtSqFeet expect a class.

    Please help me to resolve this error.
    Last edited by gep13; Aug 4th, 2011 at 01:59 AM. Reason: Edited code tags

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