Hi Everyone -
I know this is a VB6 forum, however, my end result needs to be in VB6 and not VB.NET....
The code below is VB.NET, but I need my code transfered to VB6. Basically what I am doing is having a combobox that has a list of number (1-10) and when the user selects their desired number and clicks the button - it will take all the files in a folder and delete the number of characters of the file away.
Example:
thisisafilename.txt
and after they select, lets say 3, it will look like this:
sisafilename.txt
My code in VB.NET -
Does anyone know how to do this in VB6?
Thanks in advanced
daveofgv
I know this is a VB6 forum, however, my end result needs to be in VB6 and not VB.NET....
The code below is VB.NET, but I need my code transfered to VB6. Basically what I am doing is having a combobox that has a list of number (1-10) and when the user selects their desired number and clicks the button - it will take all the files in a folder and delete the number of characters of the file away.
Example:
thisisafilename.txt
and after they select, lets say 3, it will look like this:
sisafilename.txt
My code in VB.NET -
Code:
Try
Dim astr() As String = Directory.GetFiles(TextBox1.Text)
Dim numbercount = ComboBoxEx1.Text
For Each s As String In astr
Dim FileName As String = Path.GetFileNameWithoutExtension(s)
FileName = Strings.Right(FileName, FileName.Length - numbercount)
FileName &= "" & Path.GetExtension(s)
Rename(s, Path.Combine(Path.GetDirectoryName(s), FileName))
Next s
Catch
MessageBox.Show("You must first select a folder")
End Try
Thanks in advanced
daveofgv