Determine the errors in the given form.

Posted on 2011-10-24
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
    LVL 85

    Expert Comment

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

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

    Author Comment

    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 = "Warren" so that I have assigned a value to the name Warren?
    LVL 85

    Accepted Solution

    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

    Thanks! This was a great help!

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Suggested Solutions

    It’s quite interesting for me as I worked with Excel using for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
    Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    746 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

    15 Experts available now in Live!

    Get 1:1 Help Now