Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are not able to add items to your list view because you are trying to add them from a static method.</p> <p>Since it is static there is no <code>ListView</code> because there isn't actually a <code>Form</code> to add things to. You will need to make <code>DriveRecursion()</code> not static in order to add things to the <code>ListView</code>.</p> <p>Additionally, when you make <code>DriveRecursion()</code> not static, you will need a way to let <code>Form1</code> know which <code>DriveRecursion_Results</code> class to populate.</p> <p>Another approach you could take is having <code>Form1</code> return <code>retPath</code> to <code>DriveRecursion_Results</code>.</p> <p><strong>Edit</strong></p> <p><em>Removed irrelevant parts of my original answer</em></p> <p>I have copied your code exactly how you posted it. And then made the following changes to FolderSelect() in Form1.cs When I run this code. I can get the second window to pop up, but not the other window to close, because that will cause the application to quit.</p> <p>Please make sure you have ds.Show() and do at some point call ds.DriveRecursion(retPath)</p> <p>Modified FolderSelect(string) in Form1.cs:</p> <pre><code> private void 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.DriveRecursion( retPath ); ds.Show(); result = retPath; //Close this form. } return; } </code></pre>
    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