public bool SaveNewTextFile(string text) { string fileName = FileKit.GetSaveDialogFileName("txt files (*.txt)|*.txt|All files (*.*)|*.*"); if (fileName != "") { File.WriteAllText(fileName, text); openFile = fileName; return(true); } return(false); }
public bool OpenTextFile(TextBox textBox) { string fileName = FileKit.GetOpenDialogFileName("txt files (*.txt)|*.txt|All files (*.*)|*.*"); if (fileName != "") { if (File.Exists(fileName) == true) { textBox.Text = File.ReadAllText(fileName); openFile = fileName; return(true); } } return(false); }
private void databaseButton_Click(object sender, EventArgs e) { string filter = "txt files (*.txt)|*.txt"; if (algComboBox.SelectedIndex == 3) //DB { filter = "mdf files (*.mdf)|*.mdf"; } string fileName = ""; if (newSourceRB.Checked) { fileName = FileKit.GetSaveDialogFileName(filter); } else { fileName = FileKit.GetOpenDialogFileName(filter); } sourceTextBox.Text = fileName; }