I am reading through Chapter 6, and I am confused on page 111. I see how (in Admin.
vb)
Private Sub LoadProjects()
'Declare variables
Dim objListViewItem As ListViewItem
'Inititalize a new instance of the data access base class
Using objData As New WDABase
loads and begins creating the connection to the database. What is confusing me is how we are calling the "Public Sub New()" portion of WDABase.
vb. It seems like I am used to defining a variable and then later calling that variable by assigning it as a "New" whatever type it is, then defining a value. Is there underlying code to that syntax that I don't see? Have we overwritten the default "New()" method(?) with "Public Sub New()" in Admin.
vb? Have we merely defined the "New()" method(again, is that the right term?) for the WDABase class? Will we have to do that for every class we create? Does this:
Using objData As New WDABase
or
objData = New WDABase (does that assign the same properties
as the "Using" line above?)
automatically do this:
objData.Connection = (Connection string defined in "Public Sub New()" in WDABase)
along with the other commands in "New()"?
Sorry that this was so verbose, but I just want to make sure I really get this stuff, not just that I can copy Thearon's code from his book. Not much use to me if that's all I get from reading this book.
By the way, again, this book is awesome!!!