Expand|Select|Wrap|Line Numbers
- namespace Menu
- {
- public partial class Form1 : Form
- {
- private Button button;
- private ListBox listBox1;
- private string selecteditem;
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- button = new Button();
- button.Text = "Create ListBox";
- button.AutoSize = true;
- button.Location = new Point(100, 150);
- button.Click += button1_Click;
- this.Controls.Add(button);
- }
- private void button1_Click(object sender, EventArgs e)
- {
- listBox1 = new ListBox();
- listBox1.AutoSize = true;
- listBox1.Location = new Point(75, 100);
- listBox1.MultiColumn = true;
- listBox1.BeginUpdate();
- listBox1.DoubleClick += listBox1_DoubleClick;
- this.Controls.Add(listBox1);
- listBox1.Items.Add("N-TYPE1");
- listBox1.Items.Add("N-TYPE2");
- listBox1.Items.Add("N-TYPE3");
- listBox1.Items.Add("N-TYPE4");
- listBox1.Items.Add("N-TYPE5");
- }
- private void listBox1_DoubleClick(object sender, EventArgs e)
- {
- selecteditem = String.Empty;
- string path = "E:\\New Files\\";
- string subPath = "\\D1\\";
- string subPath2 = "\\S1";
- if (listBox1.SelectedItems.Count > 0)
- {
- selecteditem = listBox1.SelectedItem.ToString();
- if (!Directory.Exists(path + "\\" + selecteditem))
- {
- Directory.CreateDirectory(path + "\\" + selecteditem);
- }
- if (!Directory.Exists(path + "\\" + selecteditem + subPath))
- {
- Directory.CreateDirectory(path + "\\" + selecteditem + subPath);
- }
- if (!Directory.Exists(path + "\\" + selecteditem + subPath2))
- {
- Directory.CreateDirectory(path + "\\" + selecteditem + subPath2);
- }
- else
- {
- //Do nothing
- }
- Console.WriteLine(path + selecteditem);
- listBox1.ClearSelected();
- }
- }
- }
- }
Console.Writeline(path + selecteditem), I would want to set this as a rootpath for an application so as to do rest of the measurements or steps only in tht path/folder.
Is it possible to do something like this?
Thank you in advance for your help.