help with comparing strings....

  • Thread starter Thread starter Paul M
  • Start date Start date
P

Paul M

hi there,

i have some code which in VB6, worked fine, but in VB.NET does not match the
following:

If Mid(sBuffer, nI, 2) = vbCrLf Then


the MID string returns the 2 squares that resemble VbCrlF, and when i put
both variables into the watch window, they return the same string, but the
match returns FALSE.

Any help appreciated,
Paul.
 
Why not test to see what is being returned?

Dim yourArray()as byte = System.Text.Encoding.Ascii.GetBytes(Mid(sBuffer,
nI, 2))

Now check what yourarray is from the locals window.
 
Hi Paul,

I would do in this case while debugging
dim a as integer = asc(mid(sBuffer, nI, 1))
dim b as integer = asc(mid(sBuffer, nI+1, 1))

To be sure that it is really 13 and 10.

Cor
 
* "Paul M said:
i have some code which in VB6, worked fine, but in VB.NET does not match the
following:

Should still work fine.
If Mid(sBuffer, nI, 2) = vbCrLf Then


the MID string returns the 2 squares that resemble VbCrlF, and when i put
both variables into the watch window, they return the same string, but the
match returns FALSE.

Are you really sure that you cut out the right part?
 
Back
Top