473,406 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

how to stop late binding

Dear All,
I would like to allow a conversion of types (i.e. double to int)
but prohibit a late binding (because obfuscators don't support this).

i.e.

obj as object
obj=yyy
obj.AAA <-----//Compiler should complaint

Is it possible to configure the compiler this way?
Thanks
Boni
Nov 23 '05 #1
8 1365
"Boni" <oilia@nospam> schrieb:
I would like to allow a conversion of types (i.e. double to int)
but prohibit a late binding (because obfuscators don't support this).


Enable 'Option Strict On'. However, this will require explicit conversion
of double to integer too (i = CInt(d)').

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 23 '05 #2
Or at least make number of reported errors on strict on bigger.
So that compiler don't stop complaining after 100 errors (this way I can at
least review all of them and check if it is a bug or a feature)
"Boni" <oilia@nospam> schrieb im Newsbeitrag
news:ed**************@TK2MSFTNGP10.phx.gbl...
Dear All,
I would like to allow a conversion of types (i.e. double to int)
but prohibit a late binding (because obfuscators don't support this).

i.e.

obj as object
obj=yyy
obj.AAA <-----//Compiler should complaint

Is it possible to configure the compiler this way?
Thanks
Boni

Nov 23 '05 #3
Hallo Herfried,
Enable 'Option Strict On'. However, this will require explicit conversion
of double to integer too (i = CInt(d)'). I hate this. Even in C++ it is possible to convert double to int
implicitely. Is it absolutely unflexible? I need only to switch off late
binding. I have a huge project and I would like to avoid unnessesory
changes.Or at lease go thru project and look myself. But compiler stops
complainig after 100-th bug. Can I switch this off? --
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 23 '05 #4
BTW it is not only int to double. Even dynamic casts of derived classes must
be done explicitely then.
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schrieb im Newsbeitrag
news:%2****************@TK2MSFTNGP09.phx.gbl...
"Boni" <oilia@nospam> schrieb:
I would like to allow a conversion of types (i.e. double to int)
but prohibit a late binding (because obfuscators don't support this).


Enable 'Option Strict On'. However, this will require explicit conversion
of double to integer too (i = CInt(d)').

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 23 '05 #5
Boni,
As Herfried suggests. Option Strict On.

If Option Strict On is too strict, then you may try the using the "Project
Properties" in VB 2005 to selectively set the notification level (Error,
Warning, None) for late binding, implicit conversions, implicit type & a
number of other conditions...

However I find including Option Strict On in each .vb file to better explain
what that .vb file expects.

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Boni" <oilia@nospam> wrote in message
news:ed**************@TK2MSFTNGP10.phx.gbl...
| Dear All,
| I would like to allow a conversion of types (i.e. double to int)
| but prohibit a late binding (because obfuscators don't support this).
|
| i.e.
|
| obj as object
| obj=yyy
| obj.AAA <-----//Compiler should complaint
|
| Is it possible to configure the compiler this way?
| Thanks
| Boni
|
|
Nov 23 '05 #6
"Boni" <oilia@nospam> schrieb
BTW it is not only int to double. Even dynamic casts of derived
classes must be done explicitely then.

IMO, if you want to cast, you should cast. It's safer to enable option
strict because otherwise you can write casts that you do not want, and that
lead to errors that take you more time than you safed before due to implicit
casts. I'd always go the safe way. Have the compiler help you as much as
possible by avoiding as many errors as possible. The option is for free -
the time you have to spend to find an error is not.
Armin

Nov 23 '05 #7
"Boni" <oilia@nospam> schrieb:
Enable 'Option Strict On'. However, this will require explicit
conversion of double to integer too (i = CInt(d)'). I hate this. Even in C++ it is possible to convert double to int
implicitely.


'Option Strict On' enforces explicit casts everywhere where a type
incompatibility could occur or where information would get lost when
casting.
Is it absolutely unflexible? I need only to switch off late binding. I
have a huge project and I would like to avoid unnessesory changes.Or at
lease go thru project and look myself. But compiler stops complainig after
100-th bug. Can I switch this off?


I do not think it's unflexible. You can turn on 'Option Strict On' on
per-file basis and add the necessary cast operators to the source code.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 23 '05 #8
Boni,

I agree with you, there is not really in VBNet a kind of middle part that
shift automatically obvious type converting and non obvious type converting.

I would find it a great advance if the IDE would autocomplete the obvious
type converting itself.

As long as this is not, than I prefer as the others wrote the Option Strict
on.

I have it forever as preference and in the very seldom case I don't use I
set in top of my program Option Strict Off. I was hoping that this version
was already setting it standard to Option Strict On. Maybe the next does.

Just my thought,

Cor
Nov 23 '05 #9

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

Similar topics

21
by: Mike MacSween | last post by:
Had some trouble with Word automation. Sorted it, in the process thought I would try late binding. Some people reccomend it. So this: *********************************************************...
1
by: JD Kronicz | last post by:
Hi .. I have an issue I have been beating my head against the wall on for some time. I am trying to use late binding for MS graph so that my end users don't have to worry about having the right...
14
by: Composer | last post by:
I've read many postings about the problem of Access.References.IsBroken and the consensus seems to be that late binding is the cure-all. I have a very complex Access application that needs...
9
by: Zlatko Matić | last post by:
I was reading about late binding, but I'm not completely sure what is to be done in order to adjust code to late binding... For example, I'm not sure if this is correct: early binding: Dim ws...
5
by: eBob.com | last post by:
In another thread VJ made me aware of Tag. Fantastic! I've been wanting this capability for a long time. But it seems that I cannot use it with Option Strict On. In an event handler I have ......
30
by: lgbjr | last post by:
hi All, I've decided to use Options Strict ON in one of my apps and now I'm trying to fix a late binding issue. I have 5 integer arrays: dim IA1(500), IA2(500), IA3(500), IA4(500), IA5(500) as...
6
by: Tim Roberts | last post by:
I've been doing COM a long time, but I've just come across a behavior with late binding that surprises me. VB and VBS are not my normal milieux, so I'm hoping someone can point me to a document...
3
ADezii
by: ADezii | last post by:
The process of verifying that an Object exists and that a specified Property or Method is valid is called Binding. There are two times when this verification process can take place: during compile...
14
by: Siv | last post by:
hi, I am converting an application that writes to an Excel spreadsheet and the code trips the "option Strict" that I would like on because the parser says "option Strict On disallows late...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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...
0
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
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
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,...

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.