
mike-wigan
Members-
Posts
16 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by mike-wigan
-
this is the code the name is showing ok but the file isnt showing up i am double cliking on a file list in a list box Private Sub FilesList_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles FilesList.DoubleClick Dim _name As New ArrayList Name = InputBox("Please enter the name") Dim AddToBox As String AddToBox = Name & ": " & LstKaraokeQue.SelectedItem LstKaraokeQue.Items.Add(AddToBox) End Sub can anyone help?
-
i know if i do this Private Sub FilesList_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles FilesList.DoubleClick Dim Singer() As String 'InputBox("Singer?" = Singer(0) + 1) LstKaraokeQue.Items.Add("name") it will add the word name to the list box LstKaraokeQue. i dont want it to do that i want it to add the filename i have clicked on and add it to the list the bit what is commented out i want it to ask me for a name first and add it to the front of the file name in LstKaraokeQue can someone help ??
-
i am trying to understand a bit of code can someone please explain in detail what this dose? Dim NewThreadStart1 As New ThreadStart(AddressOf Me.ShowFilesInFolder) Dim Newthread As New Thread(NewThreadStart1) Newthread.Start() if i understand this i might beable to carry on with what i am doing
-
right i have a filelist (listbox = FilesList) that i want the user to select one file by double clicking. then it will pass it to a list box listbox = KaraokeQue in to a que but before it passes that file to the que i need a name assoiated with that file ie when double clicked it will ask for a name then pass it to the file list box with the file name and the name the user gave ie Mike ---------- file name.mp3 diane---------- file name.mp3 then i am going to pass that file one at a time to winamp for playing so i must keep the file path somehow.. i am thinking of this way but not to sure how to get it working fully the controls i have are combobox = DrivesList listbox = FoldersList listbox = FilesList ----- The place i want the double click to come from---------- listbox = KaraokeQue ---- the place i want the playlist ---- this is the code for my file browser Dim currentDir As String Public Shared E_Path As TextBox Dim modern As Date Public Shared Main_Files As ListBox Dim ChosenFiles() As String Dim intSize As Integer = 0 Dim MyProgress As New ProgressBar Dim MyProgressCopy As New ProgressBar Dim StrGenre As String Dim Genre As Integer Dim tooltip1 As New ToolTip '****** file browser load ****** modern = Date.Now 'task.SelectedIndex = 2 'E_Path = TextBox1 On Error Resume Next If DrivesList.Text = "" Then DrivesList.Items.Clear() ShowAllDrives() DrivesList.SelectedIndex = 0 Me.Text = Directory.GetCurrentDirectory Else DrivesList.Items.Clear() ShowAllDrives() DrivesList.Items.Insert(0, DrivesList.Text) DrivesList.SelectedIndex = 0 'Me.Text = Directory.GetCurrentDirectory End If 'MyProgress = ProgressBar1 'MyProgress.Value = 0 'MyProgressCopy = ProgressBar2 'MyProgressCopy.Value = 0 'Artist_ComboBox.Items.Insert(0, "Artist <Do Not Change>") 'Album_ComboBox.Items.Insert(0, "Album <Do Not Change>") 'TrackName_ComboBox.Items.Insert(0, "Track Name <Do Not Change>") 'Year_ComboBox.Items.Insert(0, "Year <Do Not Change>") 'CreateMyToolTip() '******** End file browser ****** End Sub '********************************************************************* ****************** '*************** Enumeration SubRoutines ***************************************** '********************************************************************* ****************** 'FOLDERS LIST Private Sub FoldersList_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FoldersList.SelectedIndexChanged Dim DI As DirectoryInfo Select Case FoldersList.Text Case "" MsgBox("Select a Folder to Expand", MsgBoxStyle.Information, "Batch Renamer") Exit Sub Case ".." Try DrivesList.Text = "" Directory.SetCurrentDirectory("..") DrivesList.Text = Directory.GetCurrentDirectory Catch End Try Case Else Try DrivesList.Text = "" Dim Path As String = DrivesList.Text DrivesList.Text = Path & FoldersList.SelectedItem Directory.SetCurrentDirectory(DrivesList.Text) 'frmKaraoke.E_Path.Text = DrivesList.Text Catch : End Try End Select Dim folders() As String Dim selectedFolder As String = FoldersList.Text Try folders = Directory.GetDirectories(Directory.GetCurrentDirectory) FoldersList.Items.Clear() FoldersList.Items.Add("..") Catch : End Try Dim fldr As String For Each fldr In folders Try DI = New DirectoryInfo(fldr) FoldersList.Items.Add(fldr) 'TextBox1.Text = fldr Catch : End Try Next 'Me.Text = Directory.GetCurrentDirectory & " - [Mike N Dis Karaokes Form 2006 ]" Dim NewThreadStart1 As New ThreadStart(AddressOf Me.ShowFilesInFolder) Dim Newthread As New Thread(NewThreadStart1) Newthread.Start() End Sub 'SHOW FILES IN FOLDERS Sub ShowFilesInFolder() Dim file As String Dim i As Integer = 0 Dim FI As FileInfo 'Dim selectedFile As String = fileselect.Text FilesList.Items.Clear() For Each file In Directory.GetFiles(Directory.GetCurrentDirectory) i = i + 1 Next MyProgress.Maximum = i For Each file In Directory.GetFiles(Directory.GetCurrentDirectory) Try FI = New FileInfo(file) If InStr(LCase(FI.Name), "mp3") > 0 = True Or InStr(LCase(FI.Name), "ace") > 0 = True Or InStr(LCase(FI.Name), "zip") > 0 = True Or InStr(LCase(FI.Name), "rar") > 0 = True Then If Not FilesList.Items.Contains(FI.Name) = True Then FilesList.Items.Add(FI.Name) End If End If Catch : End Try If MyProgress.Value < MyProgress.Maximum Then MyProgress.Value = MyProgress.Value + 1 End If Next End Sub 'DRIVES LIST Private Sub DrivesList_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DrivesList.SelectedIndexChanged FoldersList.Items.Insert(0, "..") ShowFoldersInDrive(DrivesList.Text) ShowFilesInFolder() End Sub 'SHOW ALL DRIVES Sub ShowAllDrives() On Error Resume Next Dim drives() As String drives = Directory.GetLogicalDrives Dim aDrive As String For Each aDrive In drives DrivesList.Items.Add(aDrive) Next End Sub 'SHOW FOLDERS IN DRIVE Sub ShowFoldersInDrive(ByVal drive As String) Dim folders() As String Try folders = Directory.GetDirectories(drive) Catch End Try Dim fldr As String FoldersList.Items.Clear() FoldersList.Items.Insert(0, "..") Dim DI As DirectoryInfo For Each fldr In folders Try DI = New DirectoryInfo(fldr) FoldersList.Items.Add(DI.FullName) Catch End Try Next Try Directory.SetCurrentDirectory(drive) DrivesList.Text = Directory.GetCurrentDirectory & FoldersList.SelectedItem 'Me.Text = Directory.GetCurrentDirectory & " - [Mike N Dis Karaokes Form 2006 ]" Catch : MsgBox(Err.Description, MsgBoxStyle.Critical) : End Try End Sub i thought might be easier to wrap the name / path into another class. i.e. Public Class FileItem Private ReadOnly _DisplayName As String Private ReadOnly _FilePath As String Public Sub New(ByVal DisplayName As String, ByVal FilePath As String) _DisplayName = DisplayName _FilePath = FilePath End Sub Public Sub New(ByVal FilePath As String) _FilePath = FilePath _DisplayName = System.IO.Path.GetFileNameWithoutExtension(FilePath) End Sub Public Overrides Function ToString() As String Return _DisplayName End Function Public ReadOnly Property DisplayName() As String Get Return _DisplayName End Get End Property Public ReadOnly Property FilePath() As String Get Return _FilePath End Get End Property i was told if i use this with the list box. If you create an array of these i could use the array as the datasource and it will automatically use the DisplayName for the listbox text. just not sure how to sort it out i could really need a hand here ......
-
that sounds fine this is my file browser in my form the controls i have are combobox = DrivesList listbox = FoldersList listbox = FilesList listbox = KaraokeQue ---- the place i need to send the file que to ---- this is the code for my file browser Dim currentDir As String Public Shared E_Path As TextBox Dim modern As Date Public Shared Main_Files As ListBox Dim ChosenFiles() As String Dim intSize As Integer = 0 Dim MyProgress As New ProgressBar Dim MyProgressCopy As New ProgressBar Dim StrGenre As String Dim Genre As Integer Dim tooltip1 As New ToolTip '****** file browser load ****** modern = Date.Now 'task.SelectedIndex = 2 'E_Path = TextBox1 On Error Resume Next If DrivesList.Text = "" Then DrivesList.Items.Clear() ShowAllDrives() DrivesList.SelectedIndex = 0 Me.Text = Directory.GetCurrentDirectory Else DrivesList.Items.Clear() ShowAllDrives() DrivesList.Items.Insert(0, DrivesList.Text) DrivesList.SelectedIndex = 0 'Me.Text = Directory.GetCurrentDirectory End If 'MyProgress = ProgressBar1 'MyProgress.Value = 0 'MyProgressCopy = ProgressBar2 'MyProgressCopy.Value = 0 'Artist_ComboBox.Items.Insert(0, "Artist <Do Not Change>") 'Album_ComboBox.Items.Insert(0, "Album <Do Not Change>") 'TrackName_ComboBox.Items.Insert(0, "Track Name <Do Not Change>") 'Year_ComboBox.Items.Insert(0, "Year <Do Not Change>") 'CreateMyToolTip() '******** End file browser ****** End Sub '*************************************************************************************** '*************** Enumeration SubRoutines ***************************************** '*************************************************************************************** 'FOLDERS LIST Private Sub FoldersList_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FoldersList.SelectedIndexChanged Dim DI As DirectoryInfo Select Case FoldersList.Text Case "" MsgBox("Select a Folder to Expand", MsgBoxStyle.Information, "Batch Renamer") Exit Sub Case ".." Try DrivesList.Text = "" Directory.SetCurrentDirectory("..") DrivesList.Text = Directory.GetCurrentDirectory Catch End Try Case Else Try DrivesList.Text = "" Dim Path As String = DrivesList.Text DrivesList.Text = Path & FoldersList.SelectedItem Directory.SetCurrentDirectory(DrivesList.Text) 'frmKaraoke.E_Path.Text = DrivesList.Text Catch : End Try End Select Dim folders() As String Dim selectedFolder As String = FoldersList.Text Try folders = Directory.GetDirectories(Directory.GetCurrentDirectory) FoldersList.Items.Clear() FoldersList.Items.Add("..") Catch : End Try Dim fldr As String For Each fldr In folders Try DI = New DirectoryInfo(fldr) FoldersList.Items.Add(fldr) 'TextBox1.Text = fldr Catch : End Try Next 'Me.Text = Directory.GetCurrentDirectory & " - [Mike N Dis Karaokes Form 2006 ]" Dim NewThreadStart1 As New ThreadStart(AddressOf Me.ShowFilesInFolder) Dim Newthread As New Thread(NewThreadStart1) Newthread.Start() End Sub 'SHOW FILES IN FOLDERS Sub ShowFilesInFolder() Dim file As String Dim i As Integer = 0 Dim FI As FileInfo 'Dim selectedFile As String = fileselect.Text FilesList.Items.Clear() For Each file In Directory.GetFiles(Directory.GetCurrentDirectory) i = i + 1 Next MyProgress.Maximum = i For Each file In Directory.GetFiles(Directory.GetCurrentDirectory) Try FI = New FileInfo(file) If InStr(LCase(FI.Name), "mp3") > 0 = True Or InStr(LCase(FI.Name), "ace") > 0 = True Or InStr(LCase(FI.Name), "zip") > 0 = True Or InStr(LCase(FI.Name), "rar") > 0 = True Then If Not FilesList.Items.Contains(FI.Name) = True Then FilesList.Items.Add(FI.Name) End If End If Catch : End Try If MyProgress.Value < MyProgress.Maximum Then MyProgress.Value = MyProgress.Value + 1 End If Next End Sub 'DRIVES LIST Private Sub DrivesList_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DrivesList.SelectedIndexChanged FoldersList.Items.Insert(0, "..") ShowFoldersInDrive(DrivesList.Text) ShowFilesInFolder() End Sub 'SHOW ALL DRIVES Sub ShowAllDrives() On Error Resume Next Dim drives() As String drives = Directory.GetLogicalDrives Dim aDrive As String For Each aDrive In drives DrivesList.Items.Add(aDrive) Next End Sub 'SHOW FOLDERS IN DRIVE Sub ShowFoldersInDrive(ByVal drive As String) Dim folders() As String Try folders = Directory.GetDirectories(drive) Catch End Try Dim fldr As String FoldersList.Items.Clear() FoldersList.Items.Insert(0, "..") Dim DI As DirectoryInfo For Each fldr In folders Try DI = New DirectoryInfo(fldr) FoldersList.Items.Add(DI.FullName) Catch End Try Next Try Directory.SetCurrentDirectory(drive) DrivesList.Text = Directory.GetCurrentDirectory & FoldersList.SelectedItem 'Me.Text = Directory.GetCurrentDirectory & " - [Mike N Dis Karaokes Form 2006 ]" Catch : MsgBox(Err.Description, MsgBoxStyle.Critical) : End Try End Sub so how do i add that bit in now sorry i am still learning all this :confused:
-
right i have a filelist that i want the user to select one file by double clicking. then it will pass it to a list box in to a que but before it passes that file to the que i need a name assoiated with that file ie when double clicked it will ask for a name then pass it to the file list box with the file name and the name the user gave ie Mike ---------- file name diane---------- file name then i am going to pass that file one at a time to winamp for playing so i must keep the file path somehow.. anyone anyideas how this can be done
-
got it thanks for the help :p
-
i have 3 controls Combobox (DriveList) Listbox (FoldersList) ListBox (FilesList) i just can not get the folders list and the files list box to fill with data not sure what i have done just have a look through the code there are no build errors or run errors all i get is the drives list box filling and thats it the others are empty Imports System.IO Imports Microsoft.Office Imports System.IO.Directory Imports System.Runtime.InteropServices Imports System.Threading 'file browser modern = Date.Now 'task.SelectedIndex = 2 E_Path = TextBox1 On Error Resume Next If DrivesList.Text = "" Then DrivesList.Items.Clear() ShowAllDrives() DrivesList.SelectedIndex = 0 Me.Text = Directory.GetCurrentDirectory Else DrivesList.Items.Clear() ShowAllDrives() DrivesList.Items.Insert(0, DrivesList.Text) DrivesList.SelectedIndex = 0 Me.Text = Directory.GetCurrentDirectory End If 'myProgress = ProgressBar1 'myProgress.Value = 0 'myProgresscopy = ProgressBar2 'myProgresscopy.Value = 0 'Artist_ComboBox.Items.Insert(0, "Artist <Do Not Change>") 'Album_ComboBox.Items.Insert(0, "Album <Do Not Change>") 'TrackName_ComboBox.Items.Insert(0, "Track Name <Do Not Change>") 'Year_ComboBox.Items.Insert(0, "Year <Do Not Change>") ' CreateMyToolTip() End Sub Sub ShowFilesInFolder() Dim file As String Dim i As Integer = 0 Dim FI As FileInfo FilesList.Items.Clear() For Each file In Directory.GetFiles(Directory.GetCurrentDirectory) i = i + 1 Next 'MyProgress.Maximum = i For Each file In Directory.GetFiles(Directory.GetCurrentDirectory) 'Try FI = New FileInfo(file) If InStr(LCase(FI.Name), "mp3") > 0 = True Or InStr(LCase(FI.Name), "ace") > 0 = True Or InStr(LCase(FI.Name), "zip") > 0 = True Or InStr(LCase(FI.Name), "rar") > 0 = True Then If Not FilesList.Items.Contains(FI.Name) = True Then FilesList.Items.Add(FI.Name) End If End If 'Catch : End Try 'If myProgress.Value < myProgress.Maximum Then 'myProgress.Value = myProgress.Value + 1 'End If Next End Sub Sub ShowAllDrives() On Error Resume Next Dim drives() As String drives = Directory.GetLogicalDrives Dim aDrive As String For Each aDrive In drives DrivesList.Items.Add(aDrive) Next End Sub Sub ShowFoldersInDrive(ByVal drive As String) Dim folders() As String Try folders = Directory.GetDirectories(drive) Catch End Try Dim fldr As String FoldersList.Items.Clear() FoldersList.Items.Insert(0, "..") Dim DI As DirectoryInfo For Each fldr In folders Try DI = New DirectoryInfo(fldr) FoldersList.Items.Add(DI.FullName) Catch End Try Next Try Directory.SetCurrentDirectory(drive) DrivesList.Text = Directory.GetCurrentDirectory & FoldersList.SelectedItem Me.Text = Directory.GetCurrentDirectory & " - [Karaoke]" Catch : MsgBox(Err.Description, MsgBoxStyle.Critical) : End Try End Sub
-
hi .... i have 14 buttons with 14 tool tip names taken from an array soundname(13) so when i mouse over i run this Code: Private Sub btnSdOne_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSdOne.MouseHover Dim tooltip1 As New ToolTip tooltip1.SetToolTip(btnSdOne, SoundsName(0)) End Sub witch is fine untill you change the setting of the sound name (witch you can in the setup menu) then the last value is still there for one second then it shows the new value and same if you change it for a third time you mouse over then the tool tip will show first value wait a second then show last value wait a second then show new value whats going on all i want it to do is show the new value all the time i tried putting in a small sub that reads the array again b4 it shows the tool tip but that doesn't work either thanks in advance
-
I have a ListView with 5 columns. I want the user to use the mouse to click on any row and have the index of that row save into a variable. Same as can be done with a listbox. I'm trying to avoid the checkbox. thanks in advance :rolleyes:
-
thanks that helps alot but no doubt i will be back ...lol WARNING Newbie at work :confused: :)
-
i have a form and i want to see folders in one window and the files in those folders in another window image attached of how i need it to work. http://www.mwarburton.pwp.blueyonder.co.uk/shot.gif
-
can anyone tell me how to set an tool tip from an array string ie button1 = name(0) button2 = name(1) etc
-
thanks to all got it working
-
i just need to scrap the reader code as its been messed about with that much im getting all sorts of errors
-
[PLAIN][resolved]reading a txt file in to an arrray[/PLAIN] i have an array of 14 values Dim sounds(13) As String and when my program closes it writes a txt file to save those values sounds.ini as follows 'file Save for sounds Dim fs As New FileStream(Application.StartupPath & "\sounds.ini", FileMode.Create) Dim sw As New StreamWriter(fs) Dim iLp As Integer Try 'Saves Sounds stored in Sounds array For iLp = 0 To sounds.GetUpperBound(0) sw.WriteLine(sounds(iLp)) Next iLp 'Close off text files sw.Close() Catch MsgBox("Could not save sound efect libary!") End Try now my problem is i can not get the file to read when the form opens again this is what i am using at the mo but it dont work at all. 'start of reader Dim lines As String Dim mySoundsr As String = Application.StartupPath & "\save.ini" Dim srr As StreamReader Dim fs As New FileStream(Application.StartupPath & "\save.ini", FileMode.Open) Try If F Then file.Exists(mySoundsr) Then fs = New FileStream(mySoundsr, FileMode.Open) srr = New StreamReader(fs) lines = srr.ReadToEnd srr.Close() sounds = lines.Split(Environment.NewLine) Else MessageBox.Show("File not found") End If Catch ex As Exception MessageBox.Show("Error reading file: " & ex.Message) End Try srr.Close() 'end of reader help please i have been at this al yesterday with no luck