Advertisement
NeonFox__

Listbox Code

May 16th, 2020
4,713
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. -- listbox code
  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. -- 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