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

Arraylist

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

Mar 11 '08 #1
10 1657
cmdolcet69 wrote:
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.
Mar 11 '08 #2
On Mar 11, 11:05 am, "Steve Gerrard" <mynameh...@comcast.netwrote:
cmdolcet69 wrote:
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.
So how then can I look for the ".." in the label
Mar 11 '08 #3
"cmdolcet69" wrote:
On Mar 11, 11:05 am, "Steve Gerrard" <mynameh...@comcast.netwrote:
cmdolcet69 wrote:
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.

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
Mar 11 '08 #4
For version 2008

For i = 0 to TmpValues.Count - 1

:-)

Cor

"Terry" <Te****@nospam.nospamschreef in bericht
news:E7**********************************@microsof t.com...
"cmdolcet69" wrote:
>On Mar 11, 11:05 am, "Steve Gerrard" <mynameh...@comcast.netwrote:
cmdolcet69 wrote:
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.

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
Mar 11 '08 #5
On 2008-03-11, Cor Ligthert[MVP] <no************@planet.nlwrote:
For version 2008

For i = 0 to TmpValues.Count - 1

:-)

Cor
What? Abusing Option Infer On? :)

--
Tom Shelton
Mar 11 '08 #6
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

"Tom Shelton" <to*********@YOUKNOWTHEDRILLcomcast.netschreef in bericht
news:e%****************@TK2MSFTNGP04.phx.gbl...
On 2008-03-11, Cor Ligthert[MVP] <no************@planet.nlwrote:
>For version 2008

For i = 0 to TmpValues.Count - 1

:-)

Cor

What? Abusing Option Infer On? :)

--
Tom Shelton
Mar 12 '08 #7
On Mar 11, 11:58*pm, "Cor Ligthert[MVP]" <notmyfirstn...@planet.nl>
wrote:
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
I realize they are on by default - but just because you can do
something, doesn't mean you should.

--
Tom Shelton
Mar 12 '08 #8
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
Mar 13 '08 #9
On Mar 13, 10:10 am, "Cor Ligthert [MVP]" <notmyfirstn...@planet.nl>
wrote:
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
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]
Mar 13 '08 #10
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

Mar 13 '08 #11

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

Similar topics

7
by: Alex Ting | last post by:
Hi Everybody, I have an issue about deleting an object from an arrayList. I've bounded a datagrid using this code where it will first run through all of the code in loadQuestions() and bind a...
3
by: george r smith | last post by:
I am trying to create an arrayList that contains multiple arrayLists. My code attempt is below. The question I have is how can I get away from creating another pAttribute list than can be added to...
3
by: Stephen | last post by:
I was wondering if someone can help me with an web application design problem. I have a aspx page which builds up an arraylist called addresses and outputs the values in the arraylist items to a...
6
by: gane kol | last post by:
Hi, I have a code that creates a datatable from an arraylist, but i am getting an error in casting in for (int intRow = 0; intRow < alLCPlist.Count; intRow++) { DataRow drow =...
4
by: Peter | last post by:
I run into this situation all the time and I'm wondering what is the most efficient way to handle this issue: I'll be pulling data out of a data source and want to load the data into an array so...
18
by: JohnR | last post by:
From reading the documentation, this should be a relatively easy thing. I have an arraylist of custom class instances which I want to search with an"indexof" where I'm passing an instance if the...
18
by: Sam | last post by:
Hi All I'm planing to write an application which allows users dynamically add their points (say you can add upto 30,000) and then draw xy graph. Should I use an array for my coordinate point...
6
by: fniles | last post by:
I am using VB.NET 2003 and a socket control to receive and sending data to clients. As I receive data in 1 thread, I put it into an arraylist, and then I remove the data from arraylist and send it...
3
by: Christopher H | last post by:
I've been reading about how C# passes ArrayLists as reference and Structs as value, but I still can't get my program to work like I want it to. Simple example: ...
1
by: =?Utf-8?B?SkI=?= | last post by:
Hello My pgm1 (User Interface Level) passes an empty ArrayList to pgm2 (Business Logic Level). pgm2 then calls pgm3 (Data Access Level) to populate the ArrayList. Question1: When pgm2 gets...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.