Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6365499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:18:05+00:00 2026-05-25T00:18:05+00:00

I have a problem with the var keyword I have defined it like this

  • 0

I have a problem with the var keyword

I have defined it like this at the form load

public partial class form1 :form
{
    public var a;


    private void form1_load(object sender, eventargs e)
    {
        // i have used "a" like this....
        a = abc.members blahhhh blahhhhh
        bindingsource1.datasource = a;
        datagridview1.datasource = bindingsource1;

    }
}

but I got the error on this line

public Var a;

the type or namespace name ‘var’ could not be defined

Can I define public class varaible so that I can access this all methods in that class?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T00:18:05+00:00Added an answer on May 25, 2026 at 12:18 am

    var in C# is different from var in other languages; in C# you use var to have the compiler determine the type of a certain local variable for you, but you cannot use it to declare fields/properties.

    You have to specify the actual type instead. I have no idea what a is, so I can’t tell you what type to use.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some problem with my code public IQueryable<PageItems> GetPageById(Guid Id) { var xml
I have a defined a simple template class. In this class I define a
I currently have this: Hotels Controller class HotelsController extends AppController { var $name =
Hi I have a problem with a javascript string var foo = \<a href=javascript(foo('a','b'))>test</a>\
I have just been helped on a problem I have here . var win
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I have problem with ActionLink. I'd like to pass to my ActionLink parameter for
I have a control declared with PartialCaching attribute, like this: [PartialCaching(60 * 60 *
I have a problem regarding assign session variable to class variable while initialize the
This is a quick one. I have the following code: foreach (var item in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.