2011-12-14 14 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:\ネクソン\戦闘SelectDirectoryを使用して "Arms"私はこれを持っているが、それは

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

folderbrowserコードが正常に動作を動作させる傾けます。これを実装する際に問題がありますか?

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

メッセージボックスを使用して、選択したパスを表示してみます。あなたが望むものを与えるかどうかを見てください。これが動作していない場合は、選択したディレクトリやソートなどの別のプロパティを試してください。私は自分自身を見るために今VSを開いていないが、選択されたパスが正しい限り、あなたが持っているものは働くべきである。私はあなたが選択したパスを持っていればそれを望むものにして、それを文字列変数に最初に割り当てると、動作するかもしれないという気持ちがあります。パスの書式設定に問題がある可能性があります。メッセージボックスを最初に試して、パスが正しいかどうかを確認してください。