Click here to Skip to main content
14,391,651 members
Rate this:
Please Sign up or sign in to vote.
See more:
The windows credentials will already be hard-coded at the back end. User should be able to login to the remote desktop just by selecting it from a drop down.

What I have tried:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;

namespace ZapperTool
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            comboBox1.Items.Add("ADC");
            comboBox1.Items.Add("GO");
        }

        private void button1_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start("calc");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Process[] _proceses = null;
            _proceses = Process.GetProcessesByName("calc");//Test
            foreach (Process proces in _proceses)
            {
                proces.Kill();
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            OpenFileDialog fdlg = new OpenFileDialog();
            fdlg.Title = "File Explorer";
            fdlg.InitialDirectory = @"c:\";
            fdlg.Filter = "All files (*.*)|*.*|All files (*.*)|*.*";
            fdlg.FilterIndex = 2;
            fdlg.RestoreDirectory = true;
            if (fdlg.ShowDialog() == DialogResult.OK)
            {
                textBox1.Text = fdlg.FileName;
            }
        }

        private void button4_Click(object sender, EventArgs e)
        {

        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            comboBox2.Items.Clear();
            if (comboBox1.SelectedItem == "ADC")
            {
                comboBox2.Items.Add("E0");
                comboBox2.Items.Add("E1");
                comboBox2.Items.Add("E2");
                comboBox2.Items.Add("E3");
                comboBox2.Items.Add("E4");
            }
            else if (comboBox1.SelectedItem == "GO")
            {
                comboBox2.Items.Add("E5");
                comboBox2.Items.Add("E6");
                comboBox2.Items.Add("E7");
                comboBox2.Items.Add("E8");
                comboBox2.Items.Add("E9");
                comboBox2.Items.Add("E10");
                comboBox2.Items.Add("E11");
            }
        }

        private void comboBox1_MouseClick(object sender, MouseEventArgs e)
        {
        // Won't work.
        //    Process p = new Process();
        //    p.StartInfo.FileName = "mstsc.exe";
        //    p.Start();
        }

        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
           //Need help in this part.
        }
    }
}
Posted
Updated 2-Aug-19 7:28am

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

See CodeProject article here: Remote Desktop using C#.NET[^]
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100