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

Problem: Late binding error with arraylist

I have an arraylist which holds a custom structure I made. (The structure
contains FirstName, LastName, Address and EmpId.)

I am trying to loop through the arraylist to write out each item. Here's
the code:
Dim i As Integer
For i = 0 To alRecentActivity.Count - 1
Debug.Write(alRecentActivity.Item(i).FirstName)
Next

Problem. It puts a blue squiggly under alRecentActivity.Item(i).FirstName
that says "Option Strict On disallows late binding". I want to keep Option
Strict On. Any ideas how I can loop through the arraylist and retrieve
particular values of each item?

Thanks.
Nov 18 '05 #1
2 1653
NM. I just converted the arraylist item to the structure type then accessed
the variables that way.

Ex:
Dim x as MyStructure
For i = 0 to alRecentActivity.Count - 1
x = CType(alRecentActivity.Item(i), MyStructure)
Debug.Write(x.FirstName)
Next

Any alternatives would be appreciated as well.

Thanks.

"VB Programmer" <I-*********@Nowhere.com> wrote in message
news:e0*************@TK2MSFTNGP12.phx.gbl...
I have an arraylist which holds a custom structure I made. (The structure
contains FirstName, LastName, Address and EmpId.)

I am trying to loop through the arraylist to write out each item. Here's
the code:
Dim i As Integer
For i = 0 To alRecentActivity.Count - 1
Debug.Write(alRecentActivity.Item(i).FirstName)
Next

Problem. It puts a blue squiggly under alRecentActivity.Item(i).FirstName
that says "Option Strict On disallows late binding". I want to keep Option Strict On. Any ideas how I can loop through the arraylist and retrieve
particular values of each item?

Thanks.

Nov 18 '05 #2
"VB Programmer" <I-*********@Nowhere.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
NM. I just converted the arraylist item to the structure type then accessed the variables that way.

Ex:
Dim x as MyStructure
For i = 0 to alRecentActivity.Count - 1
x = CType(alRecentActivity.Item(i), MyStructure)
Debug.Write(x.FirstName)
Next


If you know that each entry is of the MyStructure type, then use
DirectCast(alRecentActivity(i), MyStructure) instead.
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #3

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

Similar topics

5
by: Daniel Bass | last post by:
..Net is great for modulerising libraries, so that all you need do to access a DLL, is simply call Add Reference and wallah, it's as though the library were written in your project. But what...
12
by: Daniel Klein | last post by:
I think I've done my homework and checked around on Google Groups but this seems to be a situation not yet covered. Here is the scenario... There are two classes, Foo and Bar (actually there...
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...
1
by: Dean Slindee | last post by:
Can someone explain how to remedy the two late binding errors below when Option Strict On: Public Function ControlDataRowArrayListPaint(ByRef frm As Form, _ ByRef ctl As Control, _ ByRef...
2
by: Dean Slindee | last post by:
Can someone explain how to remedy the two late binding errors below when Option Strict On: Public Function ControlDataRowArrayListPaint(ByRef frm As Form, _ ByRef ctl As Control, _ ByRef dr...
3
by: gregory_may | last post by:
I want to prevent late binding of this statement: MyServerConnections(Myindex).client = Value But when I try with the code below, I get an editor error: "Expression is a value and therefor...
9
by: Miro | last post by:
VB 2003 and Im still new to vb, so i hope i can explain this as best I can. I have a variable defined as such: ( simple example ) Dim AVariableOfSorts(,) As Object = _ { _ {"Last", "String",...
15
by: tshad | last post by:
I have the following in my VS 2008 code: parameters(0).Value = Session("User").CompanyID I assume this means that since there is no "User" at this point I can't do this. But it will be...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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.