Good day!
I really need your help. I am trying to get the path of the running applications that the program detects but whenever I click a particular name of a running app, it will only returns the path of the project (the windows application project that I am coding in). I am confused on how to solve this problem.
Here are my codes:
    namespace getting_apps
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listBox1.ValueMember != "")
            {
                textBox1.Text = listBox1.SelectedValue.ToString();                
                string path;
                path = System.IO.Path.GetDirectoryName(
                System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
                textBox2.Text = path;
            }
            if (textBox2.Text == "getting_apps")
            {
                MessageBox.Show("asldfjasdklfjasdf");
            }
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("ProcessName");
            dt.Columns.Add("ProcessID");
            foreach (Process p in Process.GetProcesses("."))
            {
                try
                {
                    if (p.MainWindowTitle.Length > 0)
                    {
                        dt.Rows.Add();
                        dt.Rows[dt.Rows.Count - 1][0] = p.MainWindowTitle;
                        dt.Rows[dt.Rows.Count - 1][1] = p.Id.ToString();
                    }
                }
                catch { }
            }
            listBox1.DataSource = dt;
            listBox1.DisplayMember = "ProcessName";
            listBox1.ValueMember = "ProcessId";
        }
        }
    }
 
     
    