private void btfile_Click(object sender, EventArgs e) { typeSent = DataType.File; Thread t = new Thread(new ThreadStart(ChosefileDialog)); t.SetApartmentState(ApartmentState.STA); t.Start(); }
private void ChosefileDialog() { OpenFileDialog dialog = new OpenFileDialog(); dialog.Multiselect = false; if (dialog.ShowDialog() == DialogResult.OK) { string s = dialog.FileName; tbText.Text = s; System.IO.FileInfo info = new System.IO.FileInfo(s); filename = info.Name; filepath = info.DirectoryName; } else { typeSent = DataType.Text; } }
private void tbText_Click(object sender, EventArgs e) { typeSent = DataType.Text; }