Well im making a simple text editor and i was wondering how you make a open file button and a save button and stuff like that
all i have is a clear button which just sets the richtextbox1.text = "";
so yah.
any suggestions :P
Printable View
Well im making a simple text editor and i was wondering how you make a open file button and a save button and stuff like that
all i have is a clear button which just sets the richtextbox1.text = "";
so yah.
any suggestions :P
Well it depends how you want to go about doing it, you can do the long way round making your own form for saving/opening (to get the file path etc)
Or you can just add the OpenFileDialog & SaveFileDialog etc to your form then use them normally along with System.IO to do something like
Basically write to the file (Overwriting it)Code:if(openFileDialog1.ShowDialog() == DialogResult.OK)
{
string FilePath = openFileDialog1.FileName;
System.IO.TextWriter tw = new System.IO.StreamWriter(FilePath,false);
tw.WriteLine(TheContents);
tw.Close();
}
else
{
// They decided to NOT save? (clicked cancel or w/e)
}
do you have a if the enter key is pressed in textbox1 webbrowser1.Navigate command script?
What...? More details :tongue:
You mean an onkeypress event? In which case textboxes have them - just look through the events (In properties window one of the options at top is events (Lightning bolt symbol) assuming you're using visual studio)
YAY :D!!
i love you thanks sooo much
I was talking about c#... Read what i said :tongue:
Obviously i know its c#, by the tag and the fact that i gave you some C# code? :P
Double clicking on an event auto generates the method stub for you to code in
do you have one for a webbrowser where when i click enter webbrowser1.navigate is activated
when you click enter? On the textbox? use the event.. then it gives you the arguments (always seems to be named e for 'event')
then just do if e = ButtonPress.Return or w/e it is. (Cba to look it up)
You can work this bit out yourself! Use common sense! :) Its a big part of being able to code yourself.
T_T lol well whats the event called?
Code:private void textbox1_TextChanged(object sender, EventArgs e)
{
if e= Onkeydown.??!
}
no.. thats TextChanged look in the events list like i said! I'm going to stop replying now since i'm just repeating myself.