473,509 Members | 2,950 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Objects in VB.NET

al
Greetings,

I'm confused about obejects handling in vb.net. For example,

why when including NEW in some declaration cuases error, like

Dim FormBinding As New Binding 'This causes an error if NEW is included

whil NEW here doesn't causes an error

Dim i as new integer

Also, does early binding make better application????

MTIA,
Grawsha
Nov 20 '05 #1
4 985
You have to pass constructor parameters to the Binding class:
Dim FormBinding As New Binding(propName, dataSource, dataMember)
--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"al" <gr*********@yahoo.com> schreef in bericht
news:66**************************@posting.google.c om... Greetings,

I'm confused about obejects handling in vb.net. For example,

why when including NEW in some declaration cuases error, like

Dim FormBinding As New Binding 'This causes an error if NEW is included

whil NEW here doesn't causes an error

Dim i as new integer

Also, does early binding make better application????

MTIA,
Grawsha

Nov 20 '05 #2
In addition to Jan's answer, YES, use Early binding wherever possible!
"Jan Tielens" <ja*@no.spam.please.leadit.be> wrote in message
news:uT**************@TK2MSFTNGP11.phx.gbl...
You have to pass constructor parameters to the Binding class:
Dim FormBinding As New Binding(propName, dataSource, dataMember)


--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"al" <gr*********@yahoo.com> schreef in bericht
news:66**************************@posting.google.c om...
Greetings,

I'm confused about obejects handling in vb.net. For example,

why when including NEW in some declaration cuases error, like

Dim FormBinding As New Binding 'This causes an error if NEW is included
whil NEW here doesn't causes an error

Dim i as new integer

Also, does early binding make better application????

MTIA,
Grawsha


Nov 20 '05 #3
Also, as a matter of good practice, In your preferences, turn OPTION STRICT
to ON, it will save you a lot of time wasting.

Regards - OHM

William Ryan wrote:
In addition to Jan's answer, YES, use Early binding wherever possible!
"Jan Tielens" <ja*@no.spam.please.leadit.be> wrote in message
news:uT**************@TK2MSFTNGP11.phx.gbl...
You have to pass constructor parameters to the Binding class:
Dim FormBinding As New Binding(propName, dataSource, dataMember)


--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"al" <gr*********@yahoo.com> schreef in bericht
news:66**************************@posting.google.c om...
Greetings,

I'm confused about obejects handling in vb.net. For example,

why when including NEW in some declaration cuases error, like

Dim FormBinding As New Binding 'This causes an error if NEW is
included

whil NEW here doesn't causes an error

Dim i as new integer

Also, does early binding make better application????

MTIA,
Grawsha


Regards - OHM# On**********@BTInternet.com
Nov 20 '05 #4
Al,
In addition to the others comments.
Dim FormBinding As New Binding 'This causes an error if NEW is included Binding has a constructor (a Sub New) that requires parameters, you need to
supply these values in order to create a new Binding Object. Constructors
with parameters ensure that the object is properly initialized when it is
created, ensuring that you do not forget to set any required properties.

Jan gave a sample of how to do this.
Dim i as new integer Integer has a default constructor (a Sub New with no parameters) so you can
create an Integer 'value' without giving any parameters. Note: Integer is a
value type (a Structure) so you are not really creating an object here, for
lack of a better term you are creating a value. Structures always have a
default constructor!
Also, does early binding make better application???? Yes, in most cases using Early Binding (Option Strict On) makes for a better
application! As:
- your program will generally perform faster
- you have a better chance of avoiding obscure runtime errors
- your code will better show what you are intending to do

I normally include Option Strict On at the top of every source file, as its
part of that source file then. As OHM pointed out you can set it under
Project Properties & Tools Options.

Hope this helps
Jay

"al" <gr*********@yahoo.com> wrote in message
news:66**************************@posting.google.c om... Greetings,

I'm confused about obejects handling in vb.net. For example,

why when including NEW in some declaration cuases error, like

Dim FormBinding As New Binding 'This causes an error if NEW is included

whil NEW here doesn't causes an error

Dim i as new integer

Also, does early binding make better application????

MTIA,
Grawsha

Nov 20 '05 #5

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

Similar topics

2
8234
by: dasod | last post by:
I would like to know if my method to remove list objects is correct in this small test program. It seems to me that there might be a simplier way, but I'm afraid I don't know enough about list...
9
1867
by: Aguilar, James | last post by:
Hey guys. A new question: I want to use an STL libarary to hold a bunch of objects I create. Actually, it will hold references to the objects, but that's beside the point, for the most part. ...
6
2552
by: Alfonso Morra | last post by:
I have written the following code, to test the concept of storing objects in a vector. I encounter two run time errors: 1). myClass gets destructed when pushed onto the vector 2). Prog throws a...
3
3007
by: ytrewq | last post by:
Should dynamic ("expando") properties be restricted to native and user-defined objects? Or should host objects - such as references to the browser or a plug-in or to the document and its elements -...
8
1843
by: Lüpher Cypher | last post by:
Hi, Suppose we have a hierarchical class structure that looks something like this: Object | +-- Main | +-- Object1
161
7686
by: KraftDiner | last post by:
I was under the assumption that everything in python was a refrence... so if I code this: lst = for i in lst: if i==2: i = 4 print lst I though the contents of lst would be modified.....
7
8204
by: Jo | last post by:
Hi, How can i differentiate between static and dynamic allocated objects? For example: void SomeFunction1() { CObject *objectp = new CObject; CObject object;
21
2190
by: George Exarchakos | last post by:
Hi everyone, I'd like your help... Can we have a std::list<BASEwhere BASE be the base class of a class hierarchy? I want to add to this list objects that are inherited from BASE class but not...
27
2527
by: SasQ | last post by:
Hello. I wonder if literal constants are objects, or they're only "naked" values not contained in any object? I have read that literal constants may not to be allocated by the compiler. If the...
14
5980
by: Jess | last post by:
Hello, I learned that there are five kinds of static objects, namely 1. global objects 2. object defined in namespace scope 3. object declared static instead classes 4. objects declared...
0
7234
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
7136
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...
1
7069
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
7505
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
5652
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,...
0
4730
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
3203
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1570
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
441
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.