Visual Basic Help
Started by
equinox55
, Apr 09 2009 09:44 AM
#16
Posted 10 April 2009 - 02:48 PM
#17
Posted 10 April 2009 - 02:52 PM
man this would be so much easier in java, But in java can you make a self contained exe
#18
Posted 10 April 2009 - 02:54 PM
I have not worked with visual basic in about 2 years now
#19
Posted 10 April 2009 - 03:00 PM
code you code it and then show me the code for it in visual basic
#20
Posted 11 April 2009 - 02:27 PM
You can download the exe that corresponds with the code below here:
http://metallica.gee...com/equinox.exe
It is a bit crude, but it does what you wanted and you should be able to adapt it to your specific wishes.
http://metallica.gee...com/equinox.exe
Public Class equinox Public Function readfile(ByVal filename As String) As String Dim fs = New System.IO.StreamReader(filename) Dim complete As String = fs.ReadToEnd fs.close() TextBox1.Text &= complete Return complete End Function Public Function createfolders(ByVal complete As String) As Boolean Dim output As String = "" Dim ss1 As String = Chr(32) Dim ss2 As String = Chr(13) Dim moreoptions As Boolean = True Dim i As Integer = 1 Dim j As Integer = 1 Dim k As Integer = 1 Dim lastname As String = "" Dim builder As New System.Text.StringBuilder("List of last names" & vbNewLine) If complete <> "" Then While moreoptions j = complete.IndexOf(ss1, i) If j <> -1 Then k = complete.IndexOf(ss2, j) If k <> -1 Then lastname = complete.Substring((j + 1), (k - j)) Try System.IO.Directory.CreateDirectory("C:\testfolder\" & lastname) Catch ex As Exception MsgBox(ex.Message) End Try builder.Append(lastname & vbNewLine) i = k + 1 j = k Else : moreoptions = False End If Else : moreoptions = False End If End While output = builder.ToString End If TextBox1.Text &= vbNewLine & builder.ToString Return output End Function Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load pb.AllowDrop = True End Sub Private Sub pb_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles pb.DragDrop Dim filename As String Dim filePaths As String() Dim ender As String = "ready" Try filePaths = CType(e.Data.GetData(DataFormats.FileDrop), String()) Catch ex As Exception TextBox1.Text = ex.Message TextBox1.Text &= "Error Doing Drag/Drop" End Try For Each filename In filePaths TextBox1.Text &= filename & vbNewLine If createfolders(readfile(filename)) Then TextBox1.Text &= vbNewLine & ender End If Next End Sub Private Sub pb_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles pb.DragEnter If (e.Data.GetDataPresent(DataFormats.FileDrop)) Then e.Effect = DragDropEffects.Copy End If End Sub End Class
It is a bit crude, but it does what you wanted and you should be able to adapt it to your specific wishes.
#21
Posted 11 April 2009 - 03:46 PM
I know this mayseem like a basic question but how when I click "create folders" button that it will ask where to make the folders (a browse box would be awsome) and then creat them
#22
Posted 12 April 2009 - 12:51 PM
I can make a textbox where you can input the folder in which the other will be created.
#23
Posted 12 April 2009 - 02:02 PM
Same downloadlink: http://metallica.gee...com/equinox.exe
The code I added was in the createfolders function. It now looks like this:
The code I added was in the createfolders function. It now looks like this:
Public Function createfolders(ByVal complete As String) As Boolean Dim output As String = "" Dim ss1 As String = Chr(32) Dim ss2 As String = Chr(13) Dim moreoptions As Boolean = True Dim i As Integer = 1 Dim j As Integer = 1 Dim k As Integer = 1 Dim lastname As String = "" Dim approot As String = "C:\testfolder\" If rootfolder.Text <> "" Then approot = rootfolder.Text & "\" End If Dim builder As New System.Text.StringBuilder("List of last names" & vbNewLine) If complete <> "" Then While moreoptions j = complete.IndexOf(ss1, i) If j <> -1 Then k = complete.IndexOf(ss2, j) If k <> -1 Then lastname = complete.Substring((j + 1), (k - j)) Try System.IO.Directory.CreateDirectory(approot & lastname) Catch ex As Exception MsgBox(ex.Message) End Try builder.Append(lastname & vbNewLine) i = k + 1 j = k Else : moreoptions = False End If Else : moreoptions = False End If End While output = builder.ToString End If TextBox1.Text &= vbNewLine & builder.ToString Return output End Function
Similar Topics
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users