Mykro Posted December 3, 2003 Posted December 3, 2003 I'm trying to get a handle on how the NEW keyword is used in VB.NET. could someone shed some light towards this newcomer to VB.NET. Please explain in simplest terms Thanks :D Quote
samsmithnz Posted December 3, 2003 Posted December 3, 2003 When you have an object, the New keywork creates a new instance of the object and initializes it. If you don't use the New keyword, VB.NET doesn't know what sort of object it is, and it effectivity is nothing (and IS nothing). Quote Thanks Sam http://www.samsmith.co.nz
Yagdrasil Posted December 3, 2003 Posted December 3, 2003 It's also used to define constructors. So if you had something like this: Public Class MyNumber Private mNum as Long Public Sub New(StartingNumber as Long) mNum = StartingNumber End Sub End Class You could then define use the class like this: Dim x As New MyNumber(4) Dim y As MyNumber y = New MyNumber(4) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.