473,785 Members | 2,283 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1248
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.I tems(LpCnt), MyClass).String 1
Feb 14 '07 #2
Couldn't be better

thanks

"Chris Dunaway" <du******@gmail .comwrote in message
news:11******** **************@ p10g2000cwp.goo glegroups.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.I tems(LpCnt), MyClass).String 1


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.j a.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******** ******@TK2MSFTN GP04.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.j a.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(LpCn t).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******** *************** ***********@mic rosoft.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******** ******@TK2MSFTN GP04.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(LpC nt).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
3977
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: ********************************************************* Public Sub MailMerge(strQuery As String, strTemplate As String) snip Dim doc As Word.Document Dim wrdApp As Word.Application snip Set wrdApp = New Word.Application
1
7939
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 version of the MS Graph type library. Up until now I have been walking them through the process of setting the references to include their version of MS Graph library. My problem is that I can not seem to get the syntax correct .. or perhaps...
14
4312
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 hundreds of lines of code to format a Word document in a very specific way. Because my clients have various versions of Word, the problem of broken references comes up. I wish Microsoft had implemented a reasonable solution, so that VBA could do...
9
10428
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 As DAO.Workspace Dim db As DAO.Database Dim qdf As DAO.QueryDef Dim rs As DAO.Recordset
3
1439
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 = split("val1,val2,val3,val4,val5", "," .. dim strDept as String = footerValues(0
5
2054
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 ... Private Sub chkbxSelI_Click(ByVal sender As Object, ByVal e As System.EventArgs) MsgBox("bingo for number " & sender.Tag.ToString) End Sub
6
1894
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 that describes this. Here's the setup. We have a COM server, written in Python. For completeness, here is the script: ----- testserver.py ----- import pythoncom
2
8350
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 .... webOCWraooer,Copy // get the desired data into clapboard
3
16072
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 time (Early Binding) or run time (Late Binding). When you declare an Object Variable as a specific Data Type, you are using Early Binding so the verification can take place during compile time. When you declare a Variable of the generic Object Data...
14
2041
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 binding", I am struggling to understand why I am tripping this error. This is the code that causes the problems: XLApp.Goto("MonthTitleTL") 'Goes to bookmark in sheet r = XLApp.ActiveCell.Row 'sets variable r equal
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10083
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9946
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.