This program gets a list of the processes running and displays them in a ListBox. When one is clicked it puts info about the process such as start time and filename in text boxes. But some of these don't return anything and the text box remains blank and I can't figure out why.

private void ProcessList_SelectedIndexChanged(object sender, EventArgs e)
     foreach (Process process in Process.GetProcesses())
          if (process.ProcessName.ToString() == ProcessList.SelectedItem.ToString())
               FilenameBox.Text = process.StartInfo.FileName; //Does not return
               UsernameBox.Text = process.StartInfo.UserName; //Does not return
               DirectoryBox.Text = process.StartInfo.WorkingDirectory; //Does not return
               StartTimeBox.Text = process.StartTime.ToString();
               RespondingBox.Text = process.Responding.ToString();
               CreatesWindowBox.Text = process.StartInfo.CreateNoWindow.ToString();
               VirtualMemoryBox.Text = process.VirtualMemorySize64.ToString();

Does anyone know why the top three do not return anything?

StartInfo is used to start a process, not retrieve the information about a running process. Use MainModule property to get the ProcessModule class of the running process. It has information about running processes.

This question has already been answered. Start a new discussion instead.