2011-12-14 3 views
0

내가Visual Basic의 코드 클리너

Label2.Text = "Cleaned." 
    If CheckBox1.Checked = True Then 
     On Error Resume Next 
     Kill("C:\Nexon\Combat Arms\*.txt") 
    End If 
    If CheckBox2.Checked = True Then 
     On Error Resume Next 
     Kill("C:\Nexon\Combat Arms\*.jpg") 
    End If 
    If CheckBox3.Checked = True Then 
     On Error Resume Next 
     Kill("C:\Nexon\Combat Arms\*.v3d") 
    End If 
    If CheckBox4.Checked = True Then 
     On Error Resume Next 
     Kill("C:\Nexon\Combat Arms\*.bin") 
    End If 
    If CheckBox5.Checked = True Then 
     On Error Resume Next 
     Kill("C:\Nexon\Combat Arms\*.dmp") 
    End If 
    If CheckBox6.Checked = True Then 
     On Error Resume Next 
     Kill("C:\Nexon\Combat Arms\*.dump") 
    End If 
    If CheckBox7.Checked = True Then 
     On Error Resume Next 
     System.IO.File.SetAttributes("C:\Nexon\Combat Arms\EndingBanner.exe", System.IO.FileAttributes.Normal) 
     Kill("C:\Nexon\Combat Arms\EndingBanner.exe") 
    End If 
    If CheckBox8.Checked = True Then 
     On Error Resume Next 
     System.IO.File.SetAttributes("C:\Nexon\Combat Arms\CAV.exe", System.IO.FileAttributes.Normal) 
     Kill("C:\Nexon\Combat Arms\CAV.exe") 
    End If 
    If CheckBox9.Checked = True Then 
     On Error Resume Next 
     If Dir("C:\Nexon\Combat Arms\MOVIES") <> "" Then 
      Rename("C:\Nexon\Combat Arms\Game\MOVIES", "C:\Nexon\Combat Arms\Game\CLEANED") 
     End If 
    End If 

하지만 그 대신 나는 사용자가 선택하고자하는 프로그램의 디렉토리를 진술의 다음 코드를 사용하는 디렉토리 청소기를 만드는 중이라서, "C : \ 넥슨 \ 전투 Arms "SelectDirectory를 사용하여; 나는 이것을 가지고 있지만 작동시키지 않는다.

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click 
    Dim MyFolderBrowser As New System.Windows.Forms.FolderBrowserDialog 
    Dim dlgResult As DialogResult = MyFolderBrowser.ShowDialog() 

    Me.FileReference.Text = MyFolderBrowser.SelectedPath 


End Sub 
+2

"할 수 없다"는 말은하지 않습니다. 무엇을 시도하고 예상치 못한 행동을 관찰하고 있습니까? –

답변

1

폴더 브라우저 코드는 정상적으로 작동한다. 이 문제를 구현하는 데 문제가 있습니까?

Kill(Me.FileReference.Text & "\*.txt") 
0

메시지 상자를 사용하여 선택한 경로를 표시해보십시오. 원하는 것이 무엇인지 알려주는지보십시오. 이것이 작동하지 않으면 선택한 디렉토리 나 정렬과 같은 다른 속성을 시도하십시오. VS를 지금 당장 열지는 못했지만 선택 경로가 옳다면 일해야합니다. 원하는 경로를 선택한 다음 문자열 변수에 먼저 할당하면 해당 경로가 작동한다고 생각합니다. 경로의 서식 문제 일 수 있습니다. 메시지 상자를 먼저 시도하여 경로가 올바른지 확인하십시오.