실행 화면입니다.
FolderBrowserDialog 를 사용해서 폴더를 선택한후 그 안의 이미지 파일을 ListBox1.Items.AddRange(folder.GetFiles("*.jpg"))함수를 이용해서 분류하는 식으로 만들었구요.
문제는 저 리스트박스내의 아이템을 클릭할때 이미지파일의 수정 날짜가 출력되게 하고 싶은데...감이 안잡히네요...
(이벤트는 SelectedIndexChanged 를 사용 할 려고 합니다.)
GetLastWriteTime() 함수를 사용하는 것 같은데... 괄호안에는 path가 들어가야하는데... 폴더의 path를 넣으면 안되는 것 같구....
조언좀 부탁드려도 될까요??
밑에는 전체 소스입니다.
Imports System.IO
Public Class Form1
Dim folderDlg As New FolderBrowserDialog
Dim folder As DirectoryInfo
' Dim fileTime As DateTime
Dim arrayList As New ArrayList
' Dim index As Integer = 0
Private Sub btn_SFolder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_SFolder.Click
Try
If folderDlg.ShowDialog = Windows.Forms.DialogResult.OK Then '
TextBox1.Text = folderDlg.SelectedPath '
End If
Catch ex As Exception
MsgBox("*ㅡㅡ* 오 류 *ㅡㅡ*")
Exit Sub
End Try
folder = New System.IO.DirectoryInfo(folderDlg.SelectedPath)
GroupBox1.Enabled = True
End Sub
Private Sub Rb_Jpg_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Rb_Jpg.MouseClick
ListBox1.Items.Clear()
ListBox1.Items.AddRange(folder.GetFiles("*.jpg"))
GroupBox2.Enabled = True
End Sub
Private Sub Rb_All_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Rb_All.MouseClick
ListBox1.Items.Clear()
ListBox1.Items.AddRange(folder.GetFiles("*.*"))
'For Each item As String In ListBox1.SelectedIndices
' arrayList(index).Add(item)
' index += 1
'Next
'arrayList.AddRange(ListBox1.Items)
GroupBox2.Enabled = True
End Sub
Private Sub Rb_Bmp_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Rb_Bmp.MouseClick
ListBox1.Items.Clear()
ListBox1.Items.AddRange(folder.GetFiles("*.bmp"))
GroupBox2.Enabled = True
End Sub
Private Sub Rb_Two_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Rb_Two.MouseClick
ListBox1.Items.Clear()
ListBox1.Items.AddRange(folder.GetFiles("*.jpg"))
ListBox1.Items.AddRange(folder.GetFiles("*.bmp"))
GroupBox2.Enabled = True
End Sub
Private Sub btn_Start_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Start.Click
End Sub
Private Sub Rb_Day_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Rb_Day.MouseClick
ListBox1.Enabled = True
End Sub
Private Sub Rb_FSearch_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Rb_FSearch.MouseClick
ListBox1.Enabled = True
End Sub
Private Sub Rb_FSelect_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Rb_FSelect.MouseClick
ListBox1.Enabled = True
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Try
' 이 부분을 조언해주세요.... 일단 출력은 임시로 TextBox2에 할려고 합니다.
TextBox2.Text = IO.File.GetLastWriteTime()
Catch ex As Exception
MsgBox("*ㅡㅡ* 오 류 *ㅡㅡ*")
Exit Sub
End Try
End Sub
End Class