Question COnversion from C# to vb.net

Rainny

Member
Joined
Jun 9, 2008
Messages
16
Programming Experience
Beginner
VB.NET:
Dim f() As String = Directory.GetFiles(fromDir)
For i As Integer = 0 To UBound(f)
File.copy(f(i), toDir & "\" & fileNameWithoutThePath(f(i)))
Next

'********************
Public Function fileNameWithoutThePath(ByVal b As String) As String
Dim j As Int16

j = Convert.ToInt16(b.LastIndexOf("\"))
Return b.Substring(j + 1)

End Function
Can anybody help me convert to vb.net, thanks.
 
Last edited by a moderator:
VB.NET:
Dim f() As String = Directory.GetFiles(fromDir)
For i As Integer = 0 To UBound(f)
File.copy(f(i), toDir & "\" & fileNameWithoutThePath(f(i)))
Next

'********************
Public Function fileNameWithoutThePath(ByVal b As String) As String
Dim j As Int16

j = Convert.ToInt16(b.LastIndexOf("\"))
Return b.Substring(j + 1)

End Function
Can anybody help me convert to vb.net, thanks.
It's 99% there already:
VB.NET:
        Dim f() As String = Directory.GetFiles(fromDir)
        For i As Integer = 0 To f.GetUpperBound(0)
            File.Copy(f(i), toDir() & Path.DirectorySeparatorChar & Path.GetFileName(f(i)))
        Next i
 
Back
Top