Arraylist

  • Thread starter Thread starter cmdolcet69
  • Start date Start date
C

cmdolcet69

I have a tmpValues as New Arraylist

When Iget to this code:

If tmpValues.Contains("..") Then
MessageBox.Show("This is not a number")
exit sub
End If


When I put a watch on the tmpvalues and open it up I see the Items

(0)

System.windows.form.label

then all the properties of the label including the .text fields which
has the ..3 in it.

Why don't it go into the messagebox statement ("This is not a
number")?

Can anyone help ASAP

Thanks
 
cmdolcet69 said:
I have a tmpValues as New Arraylist

If tmpValues.Contains("..") Then
When I put a watch on the tmpvalues and open it up I see the Items(0)
System.windows.form.label

If tmpValues(0) is a System.Windows.Form.Label, then it contains a label, which
is not the same as a string with value ".."

You appear to have an array of labels, so tmpValues.Contains("..") will never be
true, since it is testing for a string in the array, and there are only labels
in there. Labels are not strings.
 
If tmpValues(0) is a System.Windows.Form.Label, then it contains a label, which
is not the same as a string with value ".."

You appear to have an array of labels, so tmpValues.Contains("..") will never be
true, since it is testing for a string in the array, and there are only labels
in there. Labels are not strings.

So how then can I look for the ".." in the label
 
cmdolcet69 said:
So how then can I look for the ".." in the label

You might try this...
for i as integer = 0 to tmpValues.Count - 1
if tmpValues(i).ToString.Contains("..")

and so on.

Terry
 
What? Abusing Option Infer On? :)


If you wish that you can *set* all options off, then it will work probably
as well, however with less performance.

They are in 2008 by default On.

:-)

Cor
 
If you wish that you can *set* all options off, then it will work probably
as well, however with less performance.

They are in 2008 by default On.

:-)

Cor

I realize they are on by default - but just because you can do
something, doesn't mean you should.
 
Tom,
I realize they are on by default - but just because you can do
something, doesn't mean you should.

Again disapointed in an American, I had the idea that they before they were
21 never would drink beer, never go to a bar never ................ and for
sure never smoke hash or something like that.

Just because there was told that it was the best.

Oh sorry I misread this, that is something you should. (Not me)

:-)

Cor
 
Tom,


Again disapointed in an American, I had the idea that they before they were
21 never would drink beer, never go to a bar never ................ and for
sure never smoke hash or something like that.

Just because there was told that it was the best.

Oh sorry I misread this, that is something you should. (Not me)

:-)

Cor

Cor,

I'm totally confused by what you are saying.

This is what I got from Tom's post:

Just because Option Strict is Off by default in VS 2005, it doesn't
mean you should implicitly declare your variables and casts.

Besides, in my mind, Option Infer On is just as dangerous as Option
String Off, it's scary to me to see you using it's functionality when
it should not (imo) be used. It has a huge potential (again, imo) for
abuse and should not be turned on unless it's going to be used
properly.

Thanks,

Seth Rowe [MVP]
 
Seth,

Are you afraid that I cannot protect myself.

IMO, you are not the one who should take care for the rest of the world.

Cor
 
Back
Top