473,503 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Object and New (Basic)

Hi

See this,

Public Class Elan
Public variable as Interger
Public Sub Function1()
----------
------
End Sub

Public Sub Function1()
-----
--------
End Sub
End Class
I used this class in my Web page . Like

Dim Object1 as Elan

So it's gives Error

Dim Object1 as New Elan()

Here, What is the use of New ? , B'se I have no New Mothed in this Class.
----------------------------------------------------------------------------
----
and Why we use the Dataset Oject Like this

Dim objDataSet as DataSet

Why we not use the New Monthed here?
By,
Elankathir



Nov 18 '05 #1
2 1205
All reference types (classes) must be instantiated in order to be used.
This is why you couldn't use your class until you made a new instance of it.
Even if you don't explicitly create a constructor method ("New") for you
class, the CLR will create one for you in memory.

With other classes, you can use shared members, which means that you don't
have to have an instance of the class to use the member. The "show" method
of the MessageBox class is an example of this. You don't need to create an
instance of the MessageBox to use it.

With a DataSet (or any other class) you can DECLARE it:

Dim ds as DataSet

But you won't be able to do anything with it unless you create an instance
of it or set it equal to instance of another object.
"ElanKathir" <sn**********@hotmail.com> wrote in message
news:O3**************@TK2MSFTNGP11.phx.gbl...
Hi

See this,

Public Class Elan
Public variable as Interger
Public Sub Function1()
----------
------
End Sub

Public Sub Function1()
-----
--------
End Sub
End Class
I used this class in my Web page . Like

Dim Object1 as Elan

So it's gives Error

Dim Object1 as New Elan()

Here, What is the use of New ? , B'se I have no New Mothed in this Class.
-------------------------------------------------------------------------- -- ----
and Why we use the Dataset Oject Like this

Dim objDataSet as DataSet

Why we not use the New Monthed here?
By,
Elankathir


Nov 18 '05 #2

Hi Scott M.

Thanks for you Reply, I got this b'se of u. Thanks a lot..

Thanks & Regrads,
Elankathir
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5572
by: Marcel | last post by:
Hi, I'm using Microsoft Visual Basic .NET and want to reference the ThisApplication variable but cannot get to it or find the OfficeCodeBehind class. Is this a shortcomming of the fact that I...
11
9211
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in...
2
1700
by: Chris Asaipillai | last post by:
Hi there Im starting a new course this Saturday. OBJECT ORIENTED DEVELOPMENT WITH VISUAL BASIC .NET and will cover the following concepts and principles. a.. Be able to build VB.NET...
6
13372
by: Scott M. Lyon | last post by:
As I mentioned in my other post, I'm attempting to, using COM Interop so I can update existing VB6 code to (for several specific functions) return a Hashtable from a .NET library. I've had...
5
1800
by: Aussie Rules | last post by:
Hi, Having a mental block on this one. Have done it before but can't rack my brain on how... I have an object, with a bunch on property, and I add that object to a combo box. I want the...
3
2034
by: Simon Hart | last post by:
Hi, I am trying to implement some functionality as seen in MS CRM 3.0 whereby a basic Xml is deserialized into an object which contains properties. What I want to do from here is; cast the basic...
4
1827
by: LyzH | last post by:
Someone else had a question on how to emulate a mouse click. I tried posting in that thread but I have something of a twist on this problem and I'm really in trouble here! If I don't get help...
7
13918
by: thersitz | last post by:
Hi, Very new to asp.net. Using VStudio 2005 on an XP Pro machine. Using Cassini to view. I see this error discussed all over the net but don't seem to find a way to resolve my particular...
10
1866
by: abhash | last post by:
I am bit puzzled at the following piece of code I tried: ---------------------------------------------------------------------------------- #include <iostream> using namespace std; class Test...
9
1638
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I am just starting to write some code in C#. One time I accidently used "object" instead of "Object". The program didn't complain at all and worked fine. I am just wondering is there...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7008
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7467
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5594
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5022
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4688
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3168
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.