Note that there are some explanatory texts on larger screens.

plurals
  1. POIssues with ListView & File Output
    primarykey
    data
    text
    <p>I have so many issues with my project, i really don't know where to begin. First off, i get an error "an object reference is required for non-static field, method or property". It underlines retPath (the line: DriveRecursion_results.DriveRecursion(retPath);). I have no idea how to fix this.</p> <p>THe other thing i'm still stumped on is how to populate a listview on my Windows Form. What i want is a list of files that need to be renamed (versus a list of all files in my list.) </p> <p>Can anybody help? I have been struggling miserably with this for several hours now. </p> <p>Here is my code:</p> <p>Form1.cs:</p> <pre><code>namespace FileMigration { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { FolderSelect("Please select:"); } public string FolderSelect(string txtPrompt) { //Value to be returned string result = string.Empty; //Now, we want to use the path information to population our folder selection initial location string initialCheckoutPathDir = (@"C:\"); System.IO.DirectoryInfo info = new System.IO.DirectoryInfo(initialCheckoutPathDir); FolderBrowserDialog FolderSelect = new FolderBrowserDialog(); FolderSelect.SelectedPath = info.FullName; FolderSelect.Description = txtPrompt; FolderSelect.ShowNewFolderButton = true; if (FolderSelect.ShowDialog() == DialogResult.OK) { string retPath = FolderSelect.SelectedPath; if (retPath == null) { retPath = ""; } DriveRecursion_Results ds = new DriveRecursion_Results(); ds(retPath); result = retPath; //Close this form. } return result; } } } </code></pre> <p>Here is DriveRecursion_Results.cs:</p> <pre><code>namespace FileMigration { public partial class DriveRecursion_Results : Form { public DriveRecursion_Results() { InitializeComponent(); } private void fileOutput_SelectedIndexChanged(object sender, EventArgs e) { } public void DriveRecursion(string retPath) { // string[] files = Directory.GetFiles(retPath, "*.*", SearchOption.AllDirectories); string pattern = " *[\\~#%&amp;*{}/&lt;&gt;?|\"-]+ *"; string replacement = ""; Regex regEx = new Regex(pattern); string[] fileDrive = Directory.GetFiles(retPath, "*.*", SearchOption.AllDirectories); List&lt;string&gt; filePath = new List&lt;string&gt;(); foreach (string fileNames in fileDrive) { if (regEx.IsMatch(fileNames)) { filePath.Add(fileNames); //I tried adding my listview (fileOptions) here but I cannot for some reason } } } } } </code></pre> <p>ANY help would really be appreciated :( Does anybody have any ideas on how to change my code so it actually works?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload