New in the business. Iam creating a windows form Notepad. How do I do the Button Open to open a file and a specific compatible file?
Asked
Active
Viewed 74 times
2 Answers
0
KInd off. I am creating a Notepad with Visual Studio. In the Menu strip, I created a buttion save and another open. De form design its ok, now I need to lear the code c#, to put in the event "Open file" in the notepad that I am creating.
0
public MeuBloco()
{
InitializeComponent();
}
private void guardarToolStripMenuItem_Click(object sender, EventArgs e)
{
saveFileDialog1.ShowDialog();
}
private void SalvarOK(object sender, CancelEventArgs e)
{
string caminho = saveFileDialog1.FileName;
File.WriteAllText(caminho, txbJanela.Text);
}
private void abrirToolStripMenuItem_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
}
private void OpenOk(object sender, CancelEventArgs e)
{
}
}
}
// Now I need to code the event to open the file I want.