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

If (astrThisOne <> "") Then falls through even if astrThisOne <> ""

P: n/a
I use quickwatch on
(astrThisOne <> "")
and it reports: False

as it should because
astrThisOne reports: ""

Yet
If (astrThisOne <> "") Then
executes the Then clause
I'm going to try checking the length instead but would like to know what's
happening because I've got many such checks

I've got the code at Break in front of me and know what I've said above is
true because I can easily check it.
Thanks
Cal

I've got the code at Break in front of me and know what I've said above is
true because I can easily check it.
Break highlighted" DoThisItemQ = True and the quickwatchs as described
above.
If (astrThisOne <> "") Then
If (sstrLastOne <> astrThisOne) Then DoThisItemQ = True
End If
Nov 20 '05 #1
Share this Question
Share on Google+
8 Replies

P: n/a
" active" <ac****@REMOVEa-znet.com> schrieb
I use quickwatch on
(astrThisOne <> "")
and it reports: False

as it should because
astrThisOne reports: ""

Yet
If (astrThisOne <> "") Then
executes the Then clause
I'm going to try checking the length instead but would like to know
what's happening because I've got many such checks

I've got the code at Break in front of me and know what I've said
above is true because I can easily check it.
Thanks
Cal

I've got the code at Break in front of me and know what I've said
above is true because I can easily check it.
Break highlighted" DoThisItemQ = True and the quickwatchs as
described above.
If (astrThisOne <> "") Then
If (sstrLastOne <> astrThisOne) Then DoThisItemQ = True
End If


That's only a drawback/bug of the IDE. The command seems to get executed but
it does not. BTW, can easily be checked after also watching DoThisItemQ. You
will see that it stays False (if it was False before).
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2

P: n/a
* " active" <ac****@REMOVEa-znet.com> scripsit:
I use quickwatch on
(astrThisOne <> "")
and it reports: False

as it should because
astrThisOne reports: ""

Yet
If (astrThisOne <> "") Then
executes the Then clause
I'm going to try checking the length instead but would like to know what's
happening because I've got many such checks

I've got the code at Break in front of me and know what I've said above is
true because I can easily check it.


That's a "known" bug in the IDE.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

P: n/a
I do watch DoThisItemQ and it changes from False to True
which is why I investageted in the first place.

Thanks for leting me in on something that might be good to know in the
future but I don't think it solves my current problem.

I expected someone to say' you don't can't check for "" that way in VB.NET,
but I now assume it's OK.

I'm guessing that quickwatch showing astrThisOne as "" is the problem.

For one thing it's declared thus: astrThisOne As String

Quickwatch simply shows it as: astrThisOne with a value of: ""

If it is an object shouldn't quickwatch show all the members?

It get set by:
astrThisOne = Trim(CagListViews1.SelectedItem(alngColumn, alngItem))
which uses results in:

Get

Dim llvwX As ListViewItem

llvwX = lvwSelected.Items(alngIndex)

If alngColumn = 0 Then

SelectedItem = llvwX.Text

Else

SelectedItem = llvwX.SubItems(alngColumn - 1).Text

End If

End Get

I wonder what get returned fo a subitem that is never set?
I tried Debug.WriteLine(astrThisOne.ToString)
and nothing gets written when it's ""

Any ideas?

Thanks for the reply
Cal

"Armin Zingler" <az*******@freenet.de> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
" active" <ac****@REMOVEa-znet.com> schrieb
I use quickwatch on
(astrThisOne <> "")
and it reports: False

as it should because
astrThisOne reports: ""

Yet
If (astrThisOne <> "") Then
executes the Then clause
I'm going to try checking the length instead but would like to know
what's happening because I've got many such checks

I've got the code at Break in front of me and know what I've said
above is true because I can easily check it.
Thanks
Cal

I've got the code at Break in front of me and know what I've said
above is true because I can easily check it.
Break highlighted" DoThisItemQ = True and the quickwatchs as
described above.
If (astrThisOne <> "") Then
If (sstrLastOne <> astrThisOne) Then DoThisItemQ = True
End If
That's only a drawback/bug of the IDE. The command seems to get executed

but it does not. BTW, can easily be checked after also watching DoThisItemQ. You will see that it stays False (if it was False before).
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #4

P: n/a
I found something

It get set by:
astrThisOne = Trim(CagListViews1.SelectedItem(alngColumn, alngItem))

which goes to CagListViews1.SelectedItem as follows:

Get

Dim llvwX As ListViewItem

llvwX = lvwSelected.Items(alngIndex)

If alngColumn = 0 Then

SelectedItem = llvwX.Text

Else

SelectedItem = llvwX.SubItems(alngColumn - 1).Text

End If

End Get

I wonder what get returned fo a subitem that is never set?

I tried:

Dim arr() As Char
arr = astrThisOne.ToCharArray(3, 4)
Console.Write("The letters in '{0}' are: '", astrThisOne)
Console.Write(arr)
Console.WriteLine("'")
Console.WriteLine("Each letter in '{0}' is:", astrThisOne)
Dim c As Char
For Each c In arr
Console.WriteLine("/" & Asc(c) & "/")
Console.WriteLine("\" & AscW(c) & "\")
Next c

Produces 4 sets of :
\0\
/0/

Seems that listview returns 4 nulls. I'd quess "" is one null

So what to do? Generate a trim that also removes nulls?
Any other suggestions?

Nov 20 '05 #5

P: n/a
Is there somewhere I can read about it?
thanks
Cal

That's a "known" bug in the IDE.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #6

P: n/a
Bug below. Note the (3, 4) bug below.
Anyway, I get 30 pairs not 4. The original data came from a file with 30
characters for that item so I know where to look.

The problem is that the IDE shows the variable as "" when it actually
contains 30 nulls
Thanks
Cal

" active" <ac****@REMOVEa-znet.com> wrote in message
news:OT**************@TK2MSFTNGP10.phx.gbl...
I found something

It get set by:
astrThisOne = Trim(CagListViews1.SelectedItem(alngColumn, alngItem))

which goes to CagListViews1.SelectedItem as follows:

Get

Dim llvwX As ListViewItem

llvwX = lvwSelected.Items(alngIndex)

If alngColumn = 0 Then

SelectedItem = llvwX.Text

Else

SelectedItem = llvwX.SubItems(alngColumn - 1).Text

End If

End Get

I wonder what get returned fo a subitem that is never set?

I tried:

Dim arr() As Char
arr = astrThisOne.ToCharArray(3, 4)
Console.Write("The letters in '{0}' are: '", astrThisOne)
Console.Write(arr)
Console.WriteLine("'")
Console.WriteLine("Each letter in '{0}' is:", astrThisOne)
Dim c As Char
For Each c In arr
Console.WriteLine("/" & Asc(c) & "/")
Console.WriteLine("\" & AscW(c) & "\")
Next c

Produces 4 sets of :
\0\
/0/

Seems that listview returns 4 nulls. I'd quess "" is one null

So what to do? Generate a trim that also removes nulls?
Any other suggestions?

Nov 20 '05 #7

P: n/a
* " active" <ac****@REMOVEa-znet.com> scripsit:
Is there somewhere I can read about it?


I don't know... But it's "known".

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #8

P: n/a
On Sat, 6 Dec 2003 16:18:48 -0500, active wrote:

The problem is that the IDE shows the variable as "" when it actually
contains 30 nulls


That is the "known" bug. (One of them at least). If a string contains a
null, then in the IDE, it displays incorrectly.

Bad news is that it doesn't appear to be fixed in Whidbey, not yet anyway.

--
Chris

To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.
Nov 20 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.