Determine the errors in the given form.

Posted on 2011-10-24
Medium Priority
Last Modified: 2012-05-12
Dim scholar As Student

Private Sub btnGo_Click(...) Handles btnGo.Click
   DIm firstName as String
   scholar.Name = "Warren"
   firstName = scholar.Name
End Sub
Question by:kivakhimera
  • 2
  • 2
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 37021772
Is Student a Class or a Structure?

What would you need to differently with your "scholar" variable given those two choices above?

Author Comment

ID: 37021953
Honestly, I am extremely lost on this, that is why I am reaching out to an expert for help. In this scenario I have declared scholar and an object of the type "Student." If this is the case, then does my error lie in that I have not created an instance of the type "Student?"  Would I need to use a statement such as scholar = New Student (),  to clarify before I can utilize a statement such as scholar.name = "Warren" so that I have assigned a value to the name Warren?
LVL 86

Accepted Solution

Mike Tomlinson earned 1400 total points
ID: 37021959
You are right that the crux to this problem is the "New" keyword.

If Student is a CLASS, then yes, you will need to instantiate an instance with the "New" keyword.

If Student is a STRUCTURE then you do not need to use the "New" keyword.

So there may or may not be an "error" in that code, depending on how Student was designed.

Author Closing Comment

ID: 37022015
Thanks! This was a great help!

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month13 days, 15 hours left to enroll

807 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