By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,890 Members | 1,239 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,890 IT Pros & Developers. It's quick & easy.

Late binding; call could fail at run time.

P: n/a
tm
I have created a collection as follows:

Public pPrintMonthColl As Collection = New Collection

pPrintMonthColl.Add(checkBox1)
pPrintMonthColl.Add(checkBox2)
pPrintMonthColl.Add(checkBox2)

Now when I try to access a control in the collection as follows:

pPrintMonthColl(2).Checked = True

I receive the following error message:

Late binding; call could fail at run time.

How can I correct this?

tm

Feb 12 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
tm wrote:
I have created a collection as follows:

Public pPrintMonthColl As Collection = New Collection

pPrintMonthColl.Add(checkBox1)
pPrintMonthColl.Add(checkBox2)
pPrintMonthColl.Add(checkBox2)

Now when I try to access a control in the collection as follows:

pPrintMonthColl(2).Checked = True

I receive the following error message:

Late binding; call could fail at run time.

How can I correct this?

tm


directcast(pPrintMonthColl(2), checkbox).Checked = True

Chris
Feb 13 '06 #2

P: n/a
tm,

By not using late binding.

Late binding can be used if you are converting a program from VB6 to VB.Net,
in all other situations set in top of your program "Option Strict On" or set
that in the standard options. (I have done that and set if I want a program
with late binding in top of my program "Option Strict Off". Which I don't
have :-)

I hope this helps,

Cor
Feb 13 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.