1
Answer

To insert item into 2 combo boxes & also to print the output in the text area provided

Here i am having 2 combo boxes in which one holds devices & other holds operations.these 2 combo boxes should interact in such a way that the device selected in box1 should list out the operations performed in box2 & simultaneously it should print the equivalent code in the text area from the text file present in the project & at the end if the user needs to change the code printed the text area & also the changed code must be saved in the same text file on clicking the save button located below it.

I need the solution as soon as possible

Attachment: filereadformsauto.rar

Answers (1)

3
Photo of Vulpes
NA 98.3k 1.5m 12y
Try:

foreach (string file in System.IO.Directory.GetFiles(a))
{
   string asd = Path.GetFileNameWithoutExtension(file);
   string[] str = asd.Split('_');
   string sam1 = str[0];
   string sam2 = str[1];

   if(!combo1.Items.Contains(sam1)) combo1.Items.Add(sam1);
   if(!combo2.Items.Contains(sam2)) combo2.Items.Add(sam2);
}
0
Photo of Sukesh Marla
NA 11.8k 1.2m 12y
Try this one, you may like more

DropDown.DAtraSource=Directory.GetFiles(@"F:\For Blogs\RNDC").Select(x => Path.GetFileNameWithoutExtension(x)).Distinct();

Check this is correct answer if it helped