private void openBtn_Click(object sender, EventArgs e) { DiscordHandler.OpenState(); open.Filter = "Lua File|*.lua"; open.Title = "Open a file"; if (open.ShowDialog() == DialogResult.OK) { DiscordHandler.OpenedState(); System.IO.StreamReader reader = new System.IO.StreamReader(open.FileName); webBrowser1.Document.InvokeScript("SetText", new object[] { reader.ReadToEnd() }); reader.Close(); } }