[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Determine the errors in the given code form

Posted on 2011-10-24
3
Medium Priority
?
285 Views
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!
0
Comment
Question by:kivakhimera
  • 2
3 Comments
 
LVL 17

Accepted Solution

by:
sonawanekiran earned 2000 total points
ID: 37022287
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
0
 

Author Comment

by:kivakhimera
ID: 37022435
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!
0
 
LVL 17

Expert Comment

by:sonawanekiran
ID: 37022443
Show your Student class and will explain you...
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

834 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