Advertisement
AJ_Danger

..

Sep 8th, 2019
3,018
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1. //The Code For The List Box
  2. => fastColoredTextBox1.Text = File.ReadAllText($"./Scripts/{listBox1.SelectedItem}");
  3.  
  4. Refresh Code :
  5.  
  6. listBox1.Items.Clear();//Clear Items in the LuaScriptList
  7.             Functions.PopulateListBox(listBox1, "./Scripts", "*.txt");
  8.             Functions.PopulateListBox(listBox1, "./Scripts", "*.lua");
  9.  
  10.  
  11. //Code to put into Functions
  12.  
  13. public static void PopulateListBox(ListBox lsb, string Folder, string FileType)
  14.         {
  15.             DirectoryInfo dinfo = new DirectoryInfo(Folder);
  16.             FileInfo[] Files = dinfo.GetFiles(FileType);
  17.             foreach (FileInfo file in Files)
  18.             {
  19.                 lsb.Items.Add(file.Name);
  20.             }
  21.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement