Determine the errors in the given code form

Posted on 2011-10-24
Last Modified: 2012-05-12
I am trying to identify the error in the following code:
 Dim scholar As Student
Private Sub btnGo_Click(...) Handles btnGo.Click
  Dim nom as String
  Scholar = New Student ()
  m_name = "Peace, Warren"
  nom = scholar.Name
End Sub

I think that the error comes in the line m_name = "Peace, Warren." I think that it should be replaced with "scholar.Name = "Peace, Warren,"" but I am not sure thought behind this reasoning; I think this based on the VB book that I am referencing.
Thanks for any assistance!
Question by:kivakhimera
    LVL 17

    Accepted Solution

    Yes. You are correct. It seems m_name is private field for Student class and Name is property of student class. If you want access property of any class you need to create instance of that class like scholar = New Student(); Then you can access the properties (public) of that class.

      Coming at m_name. If it is private field of Student class you can not access the private field outside that class. The scope of that filed is only for that class

    Author Comment

    Sorry that I didn't include this information before, but for this scenario m_name designates student name. I think that your answer is sufficient, but I thought I would throw this info out there and see if your answer changed at all. Thanks again!
    LVL 17

    Expert Comment

    Show your Student class and will explain you...

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now