Posted
How do i make listBox1.SelectedItem text file text to show in my richtextbox???
any help please?
Replied
Easy
 private void Form1_Load(object sender, EventArgs e)
       {
           if (!Directory.Exists("Scripts"))
               Directory.CreateDirectory("Scripts");
           foreach (string file in Directory.GetFiles("Scripts"))
               this.listBox1.Items.Add((object)Path.GetFileName(file));
       }
       {
           if (!Directory.Exists("Scripts"))
               Directory.CreateDirectory("Scripts");
           foreach (string file in Directory.GetFiles("Scripts"))
               this.listBox1.Items.Add((object)Path.GetFileName(file));
       }
       private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
       {
           if (this.listBox1.SelectedItem == null)
               return;
           this.ScriptBox.Text = File.ReadAllText("Scripts\\" + this.listBox1.SelectedItem.ToString());
           this.ScriptBox.Refresh();
       }
       {
           if (this.listBox1.SelectedItem == null)
               return;
           this.ScriptBox.Text = File.ReadAllText("Scripts\\" + this.listBox1.SelectedItem.ToString());
           this.ScriptBox.Refresh();
       }
there you go
Cancel
Post
Replied
Easy , ;)Â
Here ...Â
Use this .Â
private void listBox1_SelectedIndexChanged_1(object sender, EventArgs e) => fastColoredTextBox1.Text = File.ReadAllText($"./Scripts/{listBox1.SelectedItem}");
then inside the exploit folder make a folder called Scripts...Â
then make a button and make the code this :
listBox1.Items.Clear();//Clear Items in the LuaScriptList
      Functions.PopulateListBox(listBox1, "./Scripts", "*.txt");
      Functions.PopulateListBox(listBox1, "./Scripts", "*.lua");
then go into functions and paste this :Â
public static void PopulateListBox(ListBox lsb, string Folder, string FileType)
    {
      DirectoryInfo dinfo = new DirectoryInfo(Folder);
      FileInfo[] Files = dinfo.GetFiles(FileType);
      foreach (FileInfo file in Files)
      {
        lsb.Items.Add(file.Name);
      }
    }
I love to help out .... So if this did let me know ;)Â
Cancel
Post
Users viewing this thread:
( Members: 0, Guests: 1, Total: 1 )
Cancel
Post