private void OpenPOFButton_Click(object sender, EventArgs e) { string filePath = FolderMgt.DataFolder; if (filePath.Length == 0) { filePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); } using (OpenFileDialog openFileDialog = new OpenFileDialog()) { openFileDialog.InitialDirectory = filePath; openFileDialog.Title = "Select your POF file"; openFileDialog.Filter = "POF files (*.pof)|*.pof|txt files (*.txt)|*.txt|All files (*.*)|*.*"; openFileDialog.RestoreDirectory = false; if (openFileDialog.ShowDialog() == DialogResult.OK) { //Get the path of specified file filePath = openFileDialog.FileName; if (ReadPOF.ReadPOFfile(filePath) > 0) { LoadPOFdatagridview(); } } POFpathTextBox.Text = filePath; } }
private void LoadFromTextBox(TextBox tb) { if (File.Exists(tb.Text)) { if (ReadPOF.ReadPOFfile(tb.Text) > 0) { LoadPOFdatagridview(); } } else { string msg = "File not found - consider using file dialog button"; SCTcommon.SendMessage(msg); } }