TotallyClueless
Member
- Joined
- Sep 15, 2005
- Messages
- 5
- Programming Experience
- Beginner
Problem with classes [RESOLVED]
Hi All.
Sorry to bug you with a beginners question but I am trusting there is somebody sympathetic to newbies out there. (I haven't written code since my old Turbo C++ days so maybe you can't teach an old dog new tricks...but who knows)
I am using a book from Sybex called Mastering Visual basic.NET and it gives an example on learning the basics of Classes.
Step1.
Create a class called Mininmal. It doesn't do anything its just to show how it works.
Step2.
Add a button to the form and in the Click Event Handler add this code:
Dim obj1 AS NEW Minimal ()
Console.WriteLine(obj1.ToString)
Console.WriteLine(obj1.GetHashCode)
etc...
My problem is that when I type this and try to type in the two brackets () after Minimal and press enter, the brackets disappear and I end up with:
Dim obj1 AS NEW Minimal
which of course means the instance of the Minimal class is stored in the obj1 variable, as I understand it, and I don't get any of the inherited methods I need.
What do I not understand? If I use the code example from the CD that comes with the book it works fine, but if I try to type it in myself the brackets disappear and I cannot get the same code.
I would be grateful for any help.
many thanks
Jeremy
Hi All.
Sorry to bug you with a beginners question but I am trusting there is somebody sympathetic to newbies out there. (I haven't written code since my old Turbo C++ days so maybe you can't teach an old dog new tricks...but who knows)
I am using a book from Sybex called Mastering Visual basic.NET and it gives an example on learning the basics of Classes.
Step1.
Create a class called Mininmal. It doesn't do anything its just to show how it works.
Step2.
Add a button to the form and in the Click Event Handler add this code:
Dim obj1 AS NEW Minimal ()
Console.WriteLine(obj1.ToString)
Console.WriteLine(obj1.GetHashCode)
etc...
My problem is that when I type this and try to type in the two brackets () after Minimal and press enter, the brackets disappear and I end up with:
Dim obj1 AS NEW Minimal
which of course means the instance of the Minimal class is stored in the obj1 variable, as I understand it, and I don't get any of the inherited methods I need.
What do I not understand? If I use the code example from the CD that comes with the book it works fine, but if I try to type it in myself the brackets disappear and I cannot get the same code.
I would be grateful for any help.
many thanks
Jeremy
Last edited: