.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

two string are the same, but vb.net says they are not. what could be wrong?

4 REPLIES 4
Reply
Message 1 of 5
sdren
312 Views, 4 Replies

two string are the same, but vb.net says they are not. what could be wrong?

i have two string that are the same, but vb.net says they are not. what could be wrong?
here is my except of the codes

Dim Blk As String = ""
Dim MyBlks() As String
some codes here
Dim txtFields() As String
txtLine = myFSR1.ReadLine
txtFields = txtLine.Split(",")
MyBlks = New String() {txtFields(0) , txtFields(2) , txtFields(3) , txtFields(4) }
some codes here
Blk = MyBlks(0)
some codes here
MsgBox Blk
If Blk= "doors1" Then InstallDoors1 Else InstallDoorsOther

the MsgBox displays the value of "doors1", but it does not InstallDoors1.
when i do PrintLine(myFn, Blk & "," & "doors1") it shows like below with a difference of "quotes"
"doors1",doors1

how do solve this difference? Edited by: sdren on Oct 30, 2009 7:35 PM
4 REPLIES 4
Message 2 of 5
t.willey
in reply to: sdren

You might need to look at how the string class has overridden the ' = ' operator. On a side note, is it supposed to be ' == ' instead? The single ' = ' means you are trying to assign a variable to something. If that doesn't help, then maybe you can look at the string method ' Compare '.
Message 3 of 5
_gile
in reply to: sdren

Hi Tim

The '==' is a C# operator.
It seems to me the VB '=' operator is used both to assign or to compare (but I don't know much about VB).

sdren,

Try:
Blk = txtFields(0) Edited by: _gile on Oct 30, 2009 11:03 PM


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 4 of 5
Anonymous
in reply to: sdren

sdren wrote:

> i have two string that are the same, but vb.net says they are not.

Watch for non standard characters that might not show up in the watch
window. I've seen Chr(10) at the beginning of strings causing brief
confusion. If in doubt loop through each and debug.print the asc code.

Terry
Message 5 of 5
Anonymous
in reply to: sdren

Tim, there is no '==' in VB.NET.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6281473@discussion.autodesk.com...
You might need to look at how the string class has overridden the ' = '
operator. On a side note, is it supposed to be ' == ' instead? The single
' = ' means you are trying to assign a variable to something. If that
doesn't help, then maybe you can look at the string method ' Compare '.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost