473,400 Members | 2,145 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,400 software developers and data experts.

Late Binding

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 integer

The integers in these arrays are actually pointers to different columns of
data in a text file.

I create an array of these arrays:

Dim HIndex() as Array = {IA1, IA2, IA3, IA4, IA5}

Then I use two loops to retrieve the integers from the aray of arrays:

Dim xHeader() as String
Dim T_xHeader as ArrayList

For s = 0 to 4
Do some stuff
For i = 0 to HIndex(s).Length -1
Do some stuff
T_xHeader.Add(xHeader(HIndex(s)(i))) 'Late Binding Here
Next i
Do some stuff
Next s

So, HIndex(s)(i) actually points to an value in xHeader, which is then added
to T_xHeader.

This all works fine, but, becasue I'm dimensioning HIndex as an array, I'm
getting a late binding error.

I can't figure out how to dimension HIndex to something other than array, in
order to avoid the late binding.

Any ideas would be greatly appreciated!!

TIA
Lee
Nov 21 '05 #1
30 2779
Lee,

Can you have a look at this older however simple sample from me in this
message

http://groups-beta.google.com/group/...e0848bf3?hl=en

When this is not enough, feel free to reply

I hope this helps,

Cor
Nov 21 '05 #2
Hi All,

I'm playing with some ideas regarding my first post.

The first thing I'm trying to do is get rid of the Array of Arrays (as it's
not CLS compliant). So, I'm adding a string array with the names of the
integer arrays:

Dim IA1(500), IA2(500), IA3(500), IA4(500), IA5(500) as integer
Dim Sname as String() = {"IA1", "IA2", "IA3", "IA4", "IA5"}

Dim xHeader() as String
Dim T_xHeader as ArrayList

For s = 0 to Sname.Length - 1
Do some stuff
For i = 0 to CType(Sname(s).Clone, Array).Length - 1
Do some stuff
T_xHeader.Add(xHeader(Sname(s).Clone(i))) 'Late Binding Here
Next i
Do some stuff
Next s

So, I've managed to get rid of the array of arrays, but I still have the
late binding issue.

What I'm tring to avoid is this:

For s = 0 to Sname.Length - 1
Do some stuff
if Sname(s) = "IA1" Then
For i = 0 to IA1.Length - 1
Do some stuff
T_xHeader.Add(xHeader(IA1(i))) 'Early Binding
Next i
Elseif Sname(s) = "IA2" then
For i = 0 to IA2.Length - 1
Do some stuff
T_xHeader.Add(xHeader(IA2(i))) 'Early Binding
Next i
Elseif Sname(s) = "IA3" then
For i = 0 to IA3.Length - 1
Do some stuff
T_xHeader.Add(xHeader(IA3(i))) 'Early Binding
Next i
Elseif Sname(s) = "IA4" then
For i = 0 to IA4.Length - 1
Do some stuff
T_xHeader.Add(xHeader(IA4(i))) 'Early Binding
Next i
Elseif Sname(s) = "IA5" then
For i = 0 to IA5.Length - 1
Do some stuff
T_xHeader.Add(xHeader(IA5(i))) 'Early Binding
Next i
Endif
Do some stuff
Next s

the reason I'm trying to avoid this is to prevent lots of necessary code
changes if the number of Integer arrays changes. Using my first (late
binding) method, the only changes would be to dimension another Integer
array and add it's name to the string array.

TIA
Lee
"lgbjr" <lg***@online.nospam> wrote in message
news:OJ**************@TK2MSFTNGP10.phx.gbl...
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 integer

The integers in these arrays are actually pointers to different columns of
data in a text file.

I create an array of these arrays:

Dim HIndex() as Array = {IA1, IA2, IA3, IA4, IA5}

Then I use two loops to retrieve the integers from the aray of arrays:

Dim xHeader() as String
Dim T_xHeader as ArrayList

For s = 0 to 4
Do some stuff
For i = 0 to HIndex(s).Length -1
Do some stuff
T_xHeader.Add(xHeader(HIndex(s)(i))) 'Late Binding Here
Next i
Do some stuff
Next s

So, HIndex(s)(i) actually points to an value in xHeader, which is then
added to T_xHeader.

This all works fine, but, becasue I'm dimensioning HIndex as an array, I'm
getting a late binding error.

I can't figure out how to dimension HIndex to something other than array,
in order to avoid the late binding.

Any ideas would be greatly appreciated!!

TIA
Lee

Nov 21 '05 #3
Lee,

See my earlier message, know that IList is the interface that almost every
standard array and collection implements except the VB collection.

And therefore can be used.

Cor
Nov 21 '05 #4
Thanks Cor, I'll see what I can do with this info.

"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Lee,

See my earlier message, know that IList is the interface that almost every
standard array and collection implements except the VB collection.

And therefore can be used.

Cor

Nov 21 '05 #5
"lgbjr" <lg***@online.nospam> schrieb:
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 integer

The integers in these arrays are actually pointers to different columns of
data in a text file.

I create an array of these arrays:

Dim HIndex() as Array = {IA1, IA2, IA3, IA4, IA5}

Then I use two loops to retrieve the integers from the aray of arrays:

Dim xHeader() as String
Dim T_xHeader as ArrayList

For s = 0 to 4
Do some stuff
For i = 0 to HIndex(s).Length -1
Do some stuff
T_xHeader.Add(xHeader(HIndex(s)(i))) 'Late Binding Here


The best solution is to create a jagged array (an array of arrays):

\\\
Dim IA1(500), IA2(500), IA3(500), IA4(500), IA5(500) As Integer
Dim HIndex()() As Integer = {IA1, IA2, IA3, IA4, IA5}
///

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

Nov 21 '05 #6
Herfried,

The best solution is to create a jagged array (an array of arrays):

\\\
Dim IA1(500), IA2(500), IA3(500), IA4(500), IA5(500) As Integer
Dim HIndex()() As Integer = {IA1, IA2, IA3, IA4, IA5}
///

You know my question when there is written "the best" without any
explanation.

The way you write it means under all conditions and without any execption.

You know him, however when there is the slightest doubt

Why?

Cor
Nov 21 '05 #7
Cor,
The OP stated he wanted an "array of these arrays".
| I create an array of these arrays:
| Dim HIndex() as Array = {IA1, IA2, IA3, IA4, IA5}

A Jagged or Ragged array is an "array of arrays".
http://msdn.microsoft.com/library/de...ringArrays.asp

Ergo the OP wants a Jagged array as Herfried shows.

Dim HIndex() as Integer() = {IA1, IA2, IA3, IA4, IA5}

or

Dim HIndex()() as Integer = {IA1, IA2, IA3, IA4, IA5}
Hope this helps
Jay
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
| Herfried,
| >
| > The best solution is to create a jagged array (an array of arrays):
| >
| > \\\
| > Dim IA1(500), IA2(500), IA3(500), IA4(500), IA5(500) As Integer
| > Dim HIndex()() As Integer = {IA1, IA2, IA3, IA4, IA5}
| > ///
| >
| You know my question when there is written "the best" without any
| explanation.
|
| The way you write it means under all conditions and without any execption.
|
| You know him, however when there is the slightest doubt
|
| Why?
|
| Cor
|
|
Nov 21 '05 #8
Jay,
The OP stated he wanted an "array of these arrays".
| I create an array of these arrays:
| Dim HIndex() as Array = {IA1, IA2, IA3, IA4, IA5}
I know, however he showed his code that looked like this.
Then I use two loops to retrieve the integers from the aray of arrays:
Dim xHeader() as String
Dim T_xHeader as ArrayList


I won't say that the answer from Hefried can not be right, however in my
opinion is it the situation you use it where that is. You will always see
this question from me, when somebody says it is the *best* while he is not
saying why, or in what situation. (Who ever it is).

You would know that I always tell in a completly static situation to use the
way Herfried describes and in a dynamic situation at least not to use a
static array in the dynamic part.

Cor
Nov 21 '05 #9
Cor,
| >Dim T_xHeader as ArrayList
Is part of his output, not part of his input. Hence I don't see it as part
of his question.

By output I mean it is where he is placing the results of his jagged array.
By input I mean the jagged array itself. His output could have just as
easily been a file or another fixed array!

As I stated, he states he wants an array of arrays, which is what Herfried &
I showed.

Hope this help
Jay

"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
| Jay,
|
| >The OP stated he wanted an "array of these arrays".
| >| I create an array of these arrays:
| >| Dim HIndex() as Array = {IA1, IA2, IA3, IA4, IA5}
|
| I know, however he showed his code that looked like this.
|
| >Then I use two loops to retrieve the integers from the aray of arrays:
| >Dim xHeader() as String
| >Dim T_xHeader as ArrayList
|
| I won't say that the answer from Hefried can not be right, however in my
| opinion is it the situation you use it where that is. You will always see
| this question from me, when somebody says it is the *best* while he is not
| saying why, or in what situation. (Who ever it is).
|
| You would know that I always tell in a completly static situation to use
the
| way Herfried describes and in a dynamic situation at least not to use a
| static array in the dynamic part.
|
| Cor
|
|
Nov 21 '05 #10
Jay,

The question is in my opinion a late binding question (see the subject) not
an array question.

When you say like Herfried that, using a jagged array is always the best
solution to overcome late bindings problems, than I have nothing more to
discus.
The best solution is to create a jagged array (an array of arrays):


That maybe the jagged array is the best solution for this problem, can be.
However, does not for me answer his more implicit question how to overcome
late binding in general. I nowhere saw that in yours and either in Herfrieds
text.

When it is possible, than I think that it is *better* to learn how to fish
than to give a fish.

I hope this helps

Cor
Nov 21 '05 #11
Hi All,

Cor, you are correct, the issue was really related to late binding, though I
understand why Jay and Herfield hit on the jagged array.

But, As I posted earlier, I want to stay away from the jagged array, as it's
not CLS compliant.

I had to move onto something else temporarily, but I'll post back tomorrow
with any questions regarding Cor's possible solution!

Thanks

Lee

"Cor Ligthert" <no************@planet.nl> wrote in message
news:uN****************@tk2msftngp13.phx.gbl...
Jay,

The question is in my opinion a late binding question (see the subject)
not an array question.

When you say like Herfried that, using a jagged array is always the best
solution to overcome late bindings problems, than I have nothing more to
discus.
The best solution is to create a jagged array (an array of arrays):


That maybe the jagged array is the best solution for this problem, can be.
However, does not for me answer his more implicit question how to overcome
late binding in general. I nowhere saw that in yours and either in
Herfrieds text.

When it is possible, than I think that it is *better* to learn how to fish
than to give a fish.

I hope this helps

Cor

Nov 21 '05 #12
teach how to fish
Nov 21 '05 #13
Cor,

"Cor Ligthert" <no************@planet.nl> schrieb:
The question is in my opinion a late binding question (see the subject)
not an array question.
The question is about

| [...] now I'm trying to fix a late binding issue
| [...]
| This all works fine, but, becasue I'm dimensioning HIndex as an array,
| I'm getting a late binding error.
|
| I can't figure out how to dimension HIndex to something other than
| array, in order to avoid the late binding.

All I did was answering this question.
When you say like Herfried that, using a jagged array is always the best
solution to overcome late bindings problems, than I have nothing more to
discus.
I don't think that anybody here would say that. We are talking about the
concrete question posted by the OP which was about how to fix a certain
late-binding problem.
The best solution is to create a jagged array (an array of arrays):


That maybe the jagged array is the best solution for this problem


Nobody except you is talking about something else than "this problem".
When it is possible, than I think that it is *better* to learn how to fish
than to give a fish.


I don't see how 'IList' fits into "how to learn to fish", moreover I think
it's misleading because it's not appropriate for the OP's problem.

Just my 2 Euro cents again...

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

Nov 21 '05 #14
"lgbjr" <lg***@online.nospam> schrieb:
But, As I posted earlier, I want to stay away from the jagged array, as
it's not CLS compliant.


CLS-compliance is important for "interfaces" only, which means that a class
library's public methods, for example, should not return jagged arrays.
However, there is no problem with using jagged arrays in an internal
implementation.

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

Nov 21 '05 #15
Herfried,
moreover I think it's misleading because it's not appropriate for the OP's
problem.


Have a look at the message from the OP, (Lee), that was sent before your
message.

I hope that this previous message from you gives a wrong impression about
you.

Cor
Nov 21 '05 #16
"Cor Ligthert" <no************@planet.nl> schrieb:
Have a look at the message from the OP, (Lee), that was sent before your
message.

I hope that this previous message from you gives a wrong impression about
you.


Huh?! I read the OP's message...

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

Nov 21 '05 #17
Cor & lgbjr,
| The question is in my opinion a late binding question (see the subject)
not
| an array question.
As you may know you use Option Strict On to avoid late binding! Simple,
isn't it.

From there you get into specific examples of late binding, such as this
Jagged Array, which again Herfried & I answered how to avoid late binding in
this specific situation

I hope you will agree that there is no single simple answer on how to avoid
Late Binding, other then to turn Option Strict On & handle each of the Late
Binding errors in turn...

Hope this helps
Jay
"Cor Ligthert" <no************@planet.nl> wrote in message
news:uN****************@tk2msftngp13.phx.gbl...
| Jay,
|
| The question is in my opinion a late binding question (see the subject)
not
| an array question.
|
| When you say like Herfried that, using a jagged array is always the best
| solution to overcome late bindings problems, than I have nothing more to
| discus.
|
| > The best solution is to create a jagged array (an array of arrays):
|
| That maybe the jagged array is the best solution for this problem, can be.
| However, does not for me answer his more implicit question how to overcome
| late binding in general. I nowhere saw that in yours and either in
Herfrieds
| text.
|
| When it is possible, than I think that it is *better* to learn how to fish
| than to give a fish.
|
| I hope this helps
|
| Cor
|
|
Nov 21 '05 #18
lgbjr,
| But, As I posted earlier, I want to stay away from the jagged array, as
it's
| not CLS compliant.
Where do you get that impression???

According to The Common Language Infrastructure Annotated Standard:
<quote>NOTE: So-called "jagged arrays" are CLS-compliant, but when
overloading multiple array types they are one-dimensional, zero-based arrays
of type System.Array.</quote>

Which I read to mean that the jagged array "Integer()()" is implemented as
an "System.Array of System.Array Of Integer", of course if you look at the
IL shows this is how they are implemented! Its just that C# & VB.NET offers
syntactical sugar to simplify it to Integer()() or int[][]. As you found
putting an array, any array into a System.Array variable requires late
binding, if you put the array into a strongly typed variable, such as
Integer()(), then you avoid the late binding. Also using strongly typed
variables may enable the compiler to use array specific IL instructions
instead of the methods on System.Array...

Hope this helps
Jay
"lgbjr" <lg***@online.nospam> wrote in message
news:el**************@TK2MSFTNGP12.phx.gbl...
| Hi All,
|
| Cor, you are correct, the issue was really related to late binding, though
I
| understand why Jay and Herfield hit on the jagged array.
|
| But, As I posted earlier, I want to stay away from the jagged array, as
it's
| not CLS compliant.
|
| I had to move onto something else temporarily, but I'll post back tomorrow
| with any questions regarding Cor's possible solution!
|
| Thanks
|
| Lee
|
| "Cor Ligthert" <no************@planet.nl> wrote in message
| news:uN****************@tk2msftngp13.phx.gbl...
| > Jay,
| >
| > The question is in my opinion a late binding question (see the subject)
| > not an array question.
| >
| > When you say like Herfried that, using a jagged array is always the best
| > solution to overcome late bindings problems, than I have nothing more to
| > discus.
| >
| >> The best solution is to create a jagged array (an array of arrays):
| >
| > That maybe the jagged array is the best solution for this problem, can
be.
| > However, does not for me answer his more implicit question how to
overcome
| > late binding in general. I nowhere saw that in yours and either in
| > Herfrieds text.
| >
| > When it is possible, than I think that it is *better* to learn how to
fish
| > than to give a fish.
| >
| > I hope this helps
| >
| > Cor
| >
|
|
Nov 21 '05 #19
Hmm...
| Which I read to mean that the jagged array "Integer()()" is implemented as
| an "System.Array of System.Array Of Integer", of course if you look at the
| IL shows this is how they are implemented!
Reading that just now, it doesn't make as much sense as I thought it did
when I wrote it. :-(

Reading the annotation accompanying Rule 16 in the Common Language
Infrastructure Annotated Standard it appears I was partially correct. What
I'm not certain about is if you do not overload a method on Jagged arrays if
the method is CLS compliant or not. It definitely appears if you overload a
method based on Jagged Arrays they are definitely not CLS compliant.

For example:

Public Compliant

Public Sub Sum(ByVal values As Integer()())
End Sub

End Class

Public Class NoneCompliant

Public Sub Sum(ByVal values As Integer()())
End Sub

Public Sub Sum(ByVal values As Single()())
End Sub

End Class

The way I am understanding the standard, the NoneCompliant class is not
compliant as both methods are treated as "Sum(ByVal values As
System.Array())", while the Compliant class may be compliant as there is
only a single method (its not overloaded)...

I'll have to see if I can find more info on this. Also I would be curious if
..NET 2.0 has clarified this any...

Either way, as was suggested, if the jagged array is a private
implementation detail of the type or method (its not Publicly exposed) then
the entire discussion of it being compliant or not, although interesting, is
largely academic.

Hope this helps
Jay

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:Ot*************@TK2MSFTNGP12.phx.gbl...
| lgbjr,
|| But, As I posted earlier, I want to stay away from the jagged array, as
| it's
|| not CLS compliant.
| Where do you get that impression???
|
| According to The Common Language Infrastructure Annotated Standard:
| <quote>NOTE: So-called "jagged arrays" are CLS-compliant, but when
| overloading multiple array types they are one-dimensional, zero-based
arrays
| of type System.Array.</quote>
|
| Which I read to mean that the jagged array "Integer()()" is implemented as
| an "System.Array of System.Array Of Integer", of course if you look at the
| IL shows this is how they are implemented! Its just that C# & VB.NET
offers
| syntactical sugar to simplify it to Integer()() or int[][]. As you found
| putting an array, any array into a System.Array variable requires late
| binding, if you put the array into a strongly typed variable, such as
| Integer()(), then you avoid the late binding. Also using strongly typed
| variables may enable the compiler to use array specific IL instructions
| instead of the methods on System.Array...
|
| Hope this helps
| Jay
|
|
| "lgbjr" <lg***@online.nospam> wrote in message
| news:el**************@TK2MSFTNGP12.phx.gbl...
|| Hi All,
||
|| Cor, you are correct, the issue was really related to late binding,
though
| I
|| understand why Jay and Herfield hit on the jagged array.
||
|| But, As I posted earlier, I want to stay away from the jagged array, as
| it's
|| not CLS compliant.
||
|| I had to move onto something else temporarily, but I'll post back
tomorrow
|| with any questions regarding Cor's possible solution!
||
|| Thanks
||
|| Lee
||
|| "Cor Ligthert" <no************@planet.nl> wrote in message
|| news:uN****************@tk2msftngp13.phx.gbl...
|| > Jay,
|| >
|| > The question is in my opinion a late binding question (see the subject)
|| > not an array question.
|| >
|| > When you say like Herfried that, using a jagged array is always the
best
|| > solution to overcome late bindings problems, than I have nothing more
to
|| > discus.
|| >
|| >> The best solution is to create a jagged array (an array of arrays):
|| >
|| > That maybe the jagged array is the best solution for this problem, can
| be.
|| > However, does not for me answer his more implicit question how to
| overcome
|| > late binding in general. I nowhere saw that in yours and either in
|| > Herfrieds text.
|| >
|| > When it is possible, than I think that it is *better* to learn how to
| fish
|| > than to give a fish.
|| >
|| > I hope this helps
|| >
|| > Cor
|| >
||
||
|
|
Nov 21 '05 #20
Hi All,

Actually, funny you mentioned the 2.0 Framework. The only reason I even
considered not using a jagged array was based on info I read in VS.NET 2005
docs. I've actually converted a copy of my project to run under 2.0, mostly
to get a feel for the 2005 IDE, but also to see what I might be up against
when clients wanted to go to the 2.0 framework.

To see just how easy it is to work in 2005, this is where I initially turned
Options Strict On, as all of the errors produced come with nice little
recommended fixes. when I got to the late binding issue regarding HIndex, I
started looking at Array of Arrays (just as Herfield and Jay said, using
HIndex()(), rather than HIndex() ). From the 2005 docs:

Jagged arrays are not compliant with the Common Language Specification
(CLS). This means you should not expose jagged arrays from any class you
want CLS-compliant code to consume.

Without really reading the second sentence, I decided I really didn't want
to introduce a potential problem into my app. However, I agree with Jay.
This is a private implementation, so the jagged array stays and it fixes the
late binding, so, that, as they say, is that!

thanks guys!!
Lee
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:ew**************@TK2MSFTNGP14.phx.gbl...
Hmm...
| Which I read to mean that the jagged array "Integer()()" is implemented
as
| an "System.Array of System.Array Of Integer", of course if you look at
the
| IL shows this is how they are implemented!
Reading that just now, it doesn't make as much sense as I thought it did
when I wrote it. :-(

Reading the annotation accompanying Rule 16 in the Common Language
Infrastructure Annotated Standard it appears I was partially correct. What
I'm not certain about is if you do not overload a method on Jagged arrays
if
the method is CLS compliant or not. It definitely appears if you overload
a
method based on Jagged Arrays they are definitely not CLS compliant.

For example:

Public Compliant

Public Sub Sum(ByVal values As Integer()())
End Sub

End Class

Public Class NoneCompliant

Public Sub Sum(ByVal values As Integer()())
End Sub

Public Sub Sum(ByVal values As Single()())
End Sub

End Class

The way I am understanding the standard, the NoneCompliant class is not
compliant as both methods are treated as "Sum(ByVal values As
System.Array())", while the Compliant class may be compliant as there is
only a single method (its not overloaded)...

I'll have to see if I can find more info on this. Also I would be curious
if
.NET 2.0 has clarified this any...

Either way, as was suggested, if the jagged array is a private
implementation detail of the type or method (its not Publicly exposed)
then
the entire discussion of it being compliant or not, although interesting,
is
largely academic.

Hope this helps
Jay

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:Ot*************@TK2MSFTNGP12.phx.gbl...
| lgbjr,
|| But, As I posted earlier, I want to stay away from the jagged array, as
| it's
|| not CLS compliant.
| Where do you get that impression???
|
| According to The Common Language Infrastructure Annotated Standard:
| <quote>NOTE: So-called "jagged arrays" are CLS-compliant, but when
| overloading multiple array types they are one-dimensional, zero-based
arrays
| of type System.Array.</quote>
|
| Which I read to mean that the jagged array "Integer()()" is implemented
as
| an "System.Array of System.Array Of Integer", of course if you look at
the
| IL shows this is how they are implemented! Its just that C# & VB.NET
offers
| syntactical sugar to simplify it to Integer()() or int[][]. As you found
| putting an array, any array into a System.Array variable requires late
| binding, if you put the array into a strongly typed variable, such as
| Integer()(), then you avoid the late binding. Also using strongly typed
| variables may enable the compiler to use array specific IL instructions
| instead of the methods on System.Array...
|
| Hope this helps
| Jay
|
|
| "lgbjr" <lg***@online.nospam> wrote in message
| news:el**************@TK2MSFTNGP12.phx.gbl...
|| Hi All,
||
|| Cor, you are correct, the issue was really related to late binding,
though
| I
|| understand why Jay and Herfield hit on the jagged array.
||
|| But, As I posted earlier, I want to stay away from the jagged array, as
| it's
|| not CLS compliant.
||
|| I had to move onto something else temporarily, but I'll post back
tomorrow
|| with any questions regarding Cor's possible solution!
||
|| Thanks
||
|| Lee
||
|| "Cor Ligthert" <no************@planet.nl> wrote in message
|| news:uN****************@tk2msftngp13.phx.gbl...
|| > Jay,
|| >
|| > The question is in my opinion a late binding question (see the
subject)
|| > not an array question.
|| >
|| > When you say like Herfried that, using a jagged array is always the
best
|| > solution to overcome late bindings problems, than I have nothing more
to
|| > discus.
|| >
|| >> The best solution is to create a jagged array (an array of arrays):
|| >
|| > That maybe the jagged array is the best solution for this problem,
can
| be.
|| > However, does not for me answer his more implicit question how to
| overcome
|| > late binding in general. I nowhere saw that in yours and either in
|| > Herfrieds text.
|| >
|| > When it is possible, than I think that it is *better* to learn how to
| fish
|| > than to give a fish.
|| >
|| > I hope this helps
|| >
|| > Cor
|| >
||
||
|
|

Nov 21 '05 #21
Jay,
As you may know you use Option Strict On to avoid late binding! Simple,
isn't it.

No I did not know this, it's in my opinion a completly wrong statement. I
thought you knew better. It can in my opinion give a complete wrong idea
about what Option Strict On does.

However, I made my answer for the OP and was only asking with my reply to
Herfried why he wrote that something was the *best* way.

Programming is in my opinion not a religion where you just has to believe
something when somebody write that.

However probably we disagree about that

Cor
Nov 21 '05 #22
Cor,

"Cor Ligthert" <no************@planet.nl> schrieb:
No I did not know this, it's in my opinion a completly wrong statement. I
thought you knew better. It can in my opinion give a complete wrong idea
about what Option Strict On does.

However, I made my answer for the OP and was only asking with my reply to
Herfried why he wrote that something was the *best* way.


It actually is the best way, even if you don't believe it.

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

Nov 21 '05 #23
Herfried,
No I did not know this, it's in my opinion a completly wrong statement.
I thought you knew better. It can in my opinion give a complete wrong
idea about what Option Strict On does.

However, I made my answer for the OP and was only asking with my reply to
Herfried why he wrote that something was the *best* way.


It actually is the best way, even if you don't believe it.

--

What do you mean that I don't believe? I don't see it in your quoting. What
are you referring too.

However when you want something based on believe, than you better can change
your study direction, go to a seminary. Now is the time for it while the
natural language from the Pope is German.

Cor
Nov 21 '05 #24
Lee,
Although the VB specification states they are not CLS compliant, the CLS
specification seems to state that sometimes they are CLS compliant (as
suggested by the passages I quoted earlier).

| > | According to The Common Language Infrastructure Annotated Standard:
| > | <quote>NOTE: So-called "jagged arrays" are CLS-compliant,

Which is under CLS Rule 16.

I would value the CLI specification over the VB specification...

Hope this helps
Jay
"lgbjr" <lg***@online.nospam> wrote in message
news:ek**************@TK2MSFTNGP12.phx.gbl...
| Hi All,
|
| Actually, funny you mentioned the 2.0 Framework. The only reason I even
| considered not using a jagged array was based on info I read in VS.NET
2005
| docs. I've actually converted a copy of my project to run under 2.0,
mostly
| to get a feel for the 2005 IDE, but also to see what I might be up against
| when clients wanted to go to the 2.0 framework.
|
| To see just how easy it is to work in 2005, this is where I initially
turned
| Options Strict On, as all of the errors produced come with nice little
| recommended fixes. when I got to the late binding issue regarding HIndex,
I
| started looking at Array of Arrays (just as Herfield and Jay said, using
| HIndex()(), rather than HIndex() ). From the 2005 docs:
|
| Jagged arrays are not compliant with the Common Language Specification
| (CLS). This means you should not expose jagged arrays from any class you
| want CLS-compliant code to consume.
|
| Without really reading the second sentence, I decided I really didn't want
| to introduce a potential problem into my app. However, I agree with Jay.
| This is a private implementation, so the jagged array stays and it fixes
the
| late binding, so, that, as they say, is that!
|
| thanks guys!!
| Lee
|
|
| "Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
| news:ew**************@TK2MSFTNGP14.phx.gbl...
| > Hmm...
| > | Which I read to mean that the jagged array "Integer()()" is
implemented
| > as
| > | an "System.Array of System.Array Of Integer", of course if you look at
| > the
| > | IL shows this is how they are implemented!
| > Reading that just now, it doesn't make as much sense as I thought it did
| > when I wrote it. :-(
| >
| > Reading the annotation accompanying Rule 16 in the Common Language
| > Infrastructure Annotated Standard it appears I was partially correct.
What
| > I'm not certain about is if you do not overload a method on Jagged
arrays
| > if
| > the method is CLS compliant or not. It definitely appears if you
overload
| > a
| > method based on Jagged Arrays they are definitely not CLS compliant.
| >
| > For example:
| >
| > Public Compliant
| >
| > Public Sub Sum(ByVal values As Integer()())
| > End Sub
| >
| > End Class
| >
| > Public Class NoneCompliant
| >
| > Public Sub Sum(ByVal values As Integer()())
| > End Sub
| >
| > Public Sub Sum(ByVal values As Single()())
| > End Sub
| >
| > End Class
| >
| > The way I am understanding the standard, the NoneCompliant class is not
| > compliant as both methods are treated as "Sum(ByVal values As
| > System.Array())", while the Compliant class may be compliant as there is
| > only a single method (its not overloaded)...
| >
| > I'll have to see if I can find more info on this. Also I would be
curious
| > if
| > .NET 2.0 has clarified this any...
| >
| > Either way, as was suggested, if the jagged array is a private
| > implementation detail of the type or method (its not Publicly exposed)
| > then
| > the entire discussion of it being compliant or not, although
interesting,
| > is
| > largely academic.
| >
| > Hope this helps
| > Jay
| >
| >
| >
| > "Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in
message
| > news:Ot*************@TK2MSFTNGP12.phx.gbl...
| > | lgbjr,
| > || But, As I posted earlier, I want to stay away from the jagged array,
as
| > | it's
| > || not CLS compliant.
| > | Where do you get that impression???
| > |
| > | According to The Common Language Infrastructure Annotated Standard:
| > | <quote>NOTE: So-called "jagged arrays" are CLS-compliant, but when
| > | overloading multiple array types they are one-dimensional, zero-based
| > arrays
| > | of type System.Array.</quote>
| > |
| > | Which I read to mean that the jagged array "Integer()()" is
implemented
| > as
| > | an "System.Array of System.Array Of Integer", of course if you look at
| > the
| > | IL shows this is how they are implemented! Its just that C# & VB.NET
| > offers
| > | syntactical sugar to simplify it to Integer()() or int[][]. As you
found
| > | putting an array, any array into a System.Array variable requires late
| > | binding, if you put the array into a strongly typed variable, such as
| > | Integer()(), then you avoid the late binding. Also using strongly
typed
| > | variables may enable the compiler to use array specific IL
instructions
| > | instead of the methods on System.Array...
| > |
| > | Hope this helps
| > | Jay
| > |
| > |
| > | "lgbjr" <lg***@online.nospam> wrote in message
| > | news:el**************@TK2MSFTNGP12.phx.gbl...
| > || Hi All,
| > ||
| > || Cor, you are correct, the issue was really related to late binding,
| > though
| > | I
| > || understand why Jay and Herfield hit on the jagged array.
| > ||
| > || But, As I posted earlier, I want to stay away from the jagged array,
as
| > | it's
| > || not CLS compliant.
| > ||
| > || I had to move onto something else temporarily, but I'll post back
| > tomorrow
| > || with any questions regarding Cor's possible solution!
| > ||
| > || Thanks
| > ||
| > || Lee
| > ||
| > || "Cor Ligthert" <no************@planet.nl> wrote in message
| > || news:uN****************@tk2msftngp13.phx.gbl...
| > || > Jay,
| > || >
| > || > The question is in my opinion a late binding question (see the
| > subject)
| > || > not an array question.
| > || >
| > || > When you say like Herfried that, using a jagged array is always the
| > best
| > || > solution to overcome late bindings problems, than I have nothing
more
| > to
| > || > discus.
| > || >
| > || >> The best solution is to create a jagged array (an array of
arrays):
| > || >
| > || > That maybe the jagged array is the best solution for this problem,
| > can
| > | be.
| > || > However, does not for me answer his more implicit question how to
| > | overcome
| > || > late binding in general. I nowhere saw that in yours and either in
| > || > Herfrieds text.
| > || >
| > || > When it is possible, than I think that it is *better* to learn how
to
| > | fish
| > || > than to give a fish.
| > || >
| > || > I hope this helps
| > || >
| > || > Cor
| > || >
| > ||
| > ||
| > |
| > |
| >
| >
|
|
Nov 21 '05 #25
Cor,
| > As you may know you use Option Strict On to avoid late binding! Simple,
| > isn't it.
| No I did not know this, it's in my opinion a completly wrong statement. I
| thought you knew better. It can in my opinion give a complete wrong idea
| about what Option Strict On does.
So what do you feel Option Strict On does?

According to:
http://msdn.microsoft.com/library/de...tionstrict.asp

It does two things:
1. Restricts implicit data type conversions to only widening conversions
(first paragraph)
2. Generates an error for late binding (third paragraph under the remarks).

It would seem obvious to me that if Option Strict On generates an error for
late binding, then ergo it is the what you use to avoid late binding, as
your program has a number of errors which prevents it from running, As I
stated fixing these errors will then avoid the late binding!

| Programming is in my opinion not a religion where you just has to believe
| something when somebody write that.
| However probably we disagree about that
That comment doesn't warrant a response!

Hope this helps
Jay

"Cor Ligthert" <no************@planet.nl> wrote in message
news:uN**************@TK2MSFTNGP14.phx.gbl...
| Jay,
|
| > As you may know you use Option Strict On to avoid late binding! Simple,
| > isn't it.
| >
| No I did not know this, it's in my opinion a completly wrong statement. I
| thought you knew better. It can in my opinion give a complete wrong idea
| about what Option Strict On does.
|
| However, I made my answer for the OP and was only asking with my reply to
| Herfried why he wrote that something was the *best* way.
|
| Programming is in my opinion not a religion where you just has to believe
| something when somebody write that.
|
| However probably we disagree about that
|
| Cor
|
|
Nov 21 '05 #26
Jay,
According to:
http://msdn.microsoft.com/library/de...tionstrict.asp
I know that page, I have read it before I gave my previous answer too you.
It would seem obvious to me that if Option Strict On generates an error
for
late binding, then ergo it is the what you use to avoid late binding, as
your program has a number of errors which prevents it from running, As I
stated fixing these errors will then avoid the late binding! (this is not the text from your previous message by the way which is less
impliciet).

It generates an error and when you correct that, than the object, where is
spoken about in this page, can by instance using casting or converting be
early binded. However "Option Strict On" does not avoid late binding, that
is still posible using reflection.

I showed in my first sample in this thread how to fix those errors where you
are now talking about.

From that Herfried wrote explicitly.I don't see how 'IList' fits into "how to learn to fish", moreover I think
it's misleading because it's not appropriate for the OP's problem.

("learn" was corrected by me in "teach" however Herfried quoted this one).

And because you did not amended or corrected this statement, while you are
active in this thread, do I see this as well as a message from you.

Now you are telling that "Option Strict On" needs fixing errors, while you
agreed first that where I showed how to fix those errors, and was talking
even about using for that the type or the interface, it was wrong. Even for
me, while I know what "Option Strict On" does, very confusing.

I hope this helps

Cor
Nov 21 '05 #27
Cor,
Not worth a response...

Jay

"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2***************@TK2MSFTNGP15.phx.gbl...
| Jay,
|
| > According to:
| >
http://msdn.microsoft.com/library/de...tionstrict.asp
|
| I know that page, I have read it before I gave my previous answer too you.
|
| > It would seem obvious to me that if Option Strict On generates an error
| > for
| > late binding, then ergo it is the what you use to avoid late binding, as
| > your program has a number of errors which prevents it from running, As I
| > stated fixing these errors will then avoid the late binding!
| (this is not the text from your previous message by the way which is less
| impliciet).
|
| It generates an error and when you correct that, than the object, where is
| spoken about in this page, can by instance using casting or converting be
| early binded. However "Option Strict On" does not avoid late binding, that
| is still posible using reflection.
|
| I showed in my first sample in this thread how to fix those errors where
you
| are now talking about.
|
| From that Herfried wrote explicitly.
| >I don't see how 'IList' fits into "how to learn to fish", moreover I
think
| >it's misleading because it's not appropriate for the OP's problem.
| ("learn" was corrected by me in "teach" however Herfried quoted this one).
|
| And because you did not amended or corrected this statement, while you are
| active in this thread, do I see this as well as a message from you.
|
| Now you are telling that "Option Strict On" needs fixing errors, while you
| agreed first that where I showed how to fix those errors, and was talking
| even about using for that the type or the interface, it was wrong. Even
for
| me, while I know what "Option Strict On" does, very confusing.
|
| I hope this helps
|
| Cor
|
|
Nov 21 '05 #28
> Cor,
Not worth a response...


I assume that with this answer (because you asked me impliciet in your last
message for an explanation) that you agree with me.

Option Strict does not as you wrote avoid late binding.

Cor
Nov 21 '05 #29
Cor,
You assume wrong! Its just not worth my time to haggle with you.

Jay
"Cor Ligthert" <no************@planet.nl> wrote in message
news:e8**************@tk2msftngp13.phx.gbl...
|> Cor,
| > Not worth a response...
|
| I assume that with this answer (because you asked me impliciet in your
last
| message for an explanation) that you agree with me.
|
| Option Strict does not as you wrote avoid late binding.
|
| Cor
|
|
Nov 21 '05 #30
Hi Cor,

I understand what Jay is saying (and why you have a problem with what he's
saying).

It's basically a "If A causes B And B causes C, Then A causes C" scenario.

A= Setting Options Strict On
B= Errors from use of late binding
C=Writing Code that avoids Late binding (avoidance of Late binding)

If:

Setting Options Strict On causes errors from use of late binding

And:

Errors from use of late binding causes writing code that avoids late binding
(avoidance of late binding)

Then:

Setting Options Strict On causes avoidance of late binding (or as Jay
stated, Use Options Strict On to avoid late binding)

While the assumption that A causes C is correct in this scenario, it is not
always true:

If People eat cows and cows eat grass, then people eat grass. :-)

Cheers
Lee

"Cor Ligthert" <no************@planet.nl> wrote in message
news:e8**************@tk2msftngp13.phx.gbl...
Cor,
Not worth a response...


I assume that with this answer (because you asked me impliciet in your
last message for an explanation) that you agree with me.

Option Strict does not as you wrote avoid late binding.

Cor

Nov 21 '05 #31

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 ......
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: 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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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,...
0
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...

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.