How can I stop this error, here is my code and there error occurs where i have decimal.TryParse(....

 class EstCalc
 { 
    static  void Variables (string[] args)
    {

                decimal bl; //blank length
                decimal bw; //blank width
                decimal bp; //blank perifery            
                decimal pd; //part depth
                decimal dq; //die quantity
                decimal.TryParse(quantityTB.Text, out dq);
                decimal dl; //die length
                decimal dw; //die width
                decimal ds; //die shut height
                decimal d; //density
                decimal.TryParse(densityTB.Text, out d);

What kind of error do you get?
Throwing code and saying "error" does not help very much.
decimal.TryParse works fine when I use it.

I was stated in the title "object reference required for nonstatic field.

You are right, but I can't infer from your code sample where the error is, because it is incomplete. And if possible please use code tags.

Your function is static but it's referring to variables that are part of instances.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.