conversion again

  • Thread starter Thread starter Ryan Epinos
  • Start date Start date
R

Ryan Epinos

how would i convert this from vb6:

FindChar = vbLf
SourceSP = Len(SourceFile)
If Right(SourceFile, 1) <> FindChar Then
Do Until InStr(SourceSP, SourceFile, FindChar) > 0
SourceSP = SourceSP - 1
Loop
End If

Thanks a lot!
 
Ryan
Try
Dim s As String = vbLf

Dim SourceSP As Integer = SourceFile.LastIndexOf(s)



Doug
 
Ryan Epinos said:
how would i convert this from vb6:

FindChar = vbLf
SourceSP = Len(SourceFile)
If Right(SourceFile, 1) <> FindChar Then
Do Until InStr(SourceSP, SourceFile, FindChar) > 0
SourceSP = SourceSP - 1
Loop
End If

.... no need to change anything.
 
Doug,

Or just
Dim SourceSP As Integer = SourceFile.LastIndexOf(vbcrlf)

Just to show to the OP how easy VBNet is because of the long discussion in
this newsgroup from this week

(Very good seen that LastIndex, I would probably have missed it the first
time)

:-)

Cor
 
Herfried,
... no need to change anything.

Although you are technical right, is it sometimes right to keep in mind that
a program has to be reviewed afterwards.

If you than change the code that is used to a more readable code while busy,
than it is not always wrong.

:-)

Cor
 
Cor Ligthert said:
Just to show to the OP how easy VBNet is because of the long discussion in
this newsgroup from this week

(Very good seen that LastIndex, I would probably have missed it the first
time)

.... or you can use VB's intrinsic 'InStrRev' function.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top