The New thing

  • Thread starter Thread starter Morten Snedker
  • Start date Start date
M

Morten Snedker

What is the difference between

Dim objDataSet As DataSet = New DataSet()
and
Dim objDataSet As New DataSet()
and
Dim objDataSet As DataSet()
Set objDataSet = New DataSet()

(if any?)



Regards /Snedker
 
In the third example, there are 2 problems:

Dim objDataSet as DataSet() declares an array of dataset
So
Set objDataSet = New DataSet() would not work, since you would be trying to
assing one DataSet to a variable that holds an array of datasets. Also,
there is no need for 'Set' in VB.NET.

But, if you had it:

Dim objDataSet as DataSet
objDataSet = New DataSet()

Then all 3 would be equivalent.
 
But, if you had it:

Dim objDataSet as DataSet
objDataSet = New DataSet()

That was the case. Typo from my part. Thank you both for your input
and time.


Regards /Snedker
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top