473,386 Members | 1,842 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,386 software developers and data experts.

How to avoid late binding??

Me is a combobox and the items are objects with a property "String1"

The problem with the following construct is that one does not know if there
is a typo until run time.

Me.Items(LpCnt).string1

What is the best way to force early binding or at least get the compiler to
check?

Thanks
Feb 14 '07 #1
6 1226
On Feb 14, 2:25 pm, " active" <activeNOS...@a-znet.comwrote:
Me is a combobox and the items are objects with a property "String1"

The problem with the following construct is that one does not know if there
is a typo until run time.

Me.Items(LpCnt).string1

What is the best way to force early binding or at least get the compiler to
check?

Thanks
DirectCast(Me.Items(LpCnt), MyClass).String1
Feb 14 '07 #2
Couldn't be better

thanks

"Chris Dunaway" <du******@gmail.comwrote in message
news:11**********************@p10g2000cwp.googlegr oups.com...
On Feb 14, 2:25 pm, " active" <activeNOS...@a-znet.comwrote:
>Me is a combobox and the items are objects with a property "String1"

The problem with the following construct is that one does not know if
there
is a typo until run time.

Me.Items(LpCnt).string1

What is the best way to force early binding or at least get the compiler
to
check?

Thanks

DirectCast(Me.Items(LpCnt), MyClass).String1


Feb 14 '07 #3
active wrote:
The problem with the following construct is that one does not know if there
is a typo until run time.

Me.Items(LpCnt).string1
What is the best way to force early binding or at least get the compiler to
check?
Option Strict On

Regards,
Phill W.
Feb 15 '07 #4
I haven't got myself to code that way.

If I did, what would happen - the compiler force me to add DirectCast?
Thanks

"Phill W." <p-.-a-.-w-a-r-d-@-o-p-e-n-.-a-c-.-u-kwrote in message
news:er**********@south.jnrs.ja.net...
active wrote:
>The problem with the following construct is that one does not know if
there is a typo until run time.

Me.Items(LpCnt).string1
>What is the best way to force early binding or at least get the compiler
to check?

Option Strict On

Regards,
Phill W.

Feb 15 '07 #5
Unless you have a base object which contains most of the methods you are
using you are correct.

But remember, it will take you a second to do this and over the period of
use of the appication it will save you client much time. Also you will get
many less runtime errors since the code has been checked at compile time.

Lloyd Sheen
" active" <ac**********@a-znet.comwrote in message
news:eW**************@TK2MSFTNGP04.phx.gbl...
>I haven't got myself to code that way.

If I did, what would happen - the compiler force me to add DirectCast?
Thanks

"Phill W." <p-.-a-.-w-a-r-d-@-o-p-e-n-.-a-c-.-u-kwrote in message
news:er**********@south.jnrs.ja.net...
> active wrote:
>>The problem with the following construct is that one does not know if
there is a typo until run time.

Me.Items(LpCnt).string1
>>What is the best way to force early binding or at least get the compiler
to check?

Option Strict On

Regards,
Phill W.

Feb 15 '07 #6
thanks

"Lloyd Sheen" <a@b.cwrote in message
news:C2**********************************@microsof t.com...
Unless you have a base object which contains most of the methods you are
using you are correct.

But remember, it will take you a second to do this and over the period of
use of the appication it will save you client much time. Also you will
get many less runtime errors since the code has been checked at compile
time.

Lloyd Sheen
" active" <ac**********@a-znet.comwrote in message
news:eW**************@TK2MSFTNGP04.phx.gbl...
>>I haven't got myself to code that way.

If I did, what would happen - the compiler force me to add DirectCast?
Thanks

"Phill W." <p-.-a-.-w-a-r-d-@-o-p-e-n-.-a-c-.-u-kwrote in message
news:er**********@south.jnrs.ja.net...
>> active wrote:

The problem with the following construct is that one does not know if
there is a typo until run time.

Me.Items(LpCnt).string1

What is the best way to force early binding or at least get the
compiler to check?

Option Strict On

Regards,
Phill W.


Feb 15 '07 #7

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...
3
by: Thomas Müller-Lynch | last post by:
How can I avoid late binding with the directive strict = tru My ASP .net-file looks like this <%@DEBUG=true TRACE=true Strict=false EXPLICIT=true% .. dim footerValues as Arra footerValues =...
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 ......
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...
2
by: GS | last post by:
I have installed the ms PIA for ofc XP, and followed the article http://support.microsoft.com/kb/247412/ trying to paste into a worksheet However I got late binding not allowed errors .......
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.