Hi All, I have browse button to select a .hex file, this file name should always have 3 underscores and .hex as extention (for eg. TestHex_1_1_1.hex). I had written a code by using split & it works. But if foldername contains any underscore then it will not work. This is my code. private void btnOpenFolder1_Click(object sender, EventArgs e) { openFileDialog1.ShowDialog(); openFileDialog1.ValidateNames = true; textBox1.Text = openFileDialog1.FileName; char[] cr ={ '_' }; string[] str = textBox1.Text.Split(cr); if (str.Length != 4 || textBox1.Text.Substring(textBox1.Text.LastIndexOf("."), 4).ToLower() != ".hex") { textBox1.Text = ""; MessageBox.Show("File name or file extention is not valid."); } hexPath = textBox1.Text; } Please give me any suggestion.
Y
Yogesh Tayade
@Yogesh Tayade
Posts
-
Filename check with extention -
Show progress barHi All, I have a file to send to client rtu. I want to display progress bar while sending file. How it should be implemented in windows form in c#.
-
How to focus on button.Hi all, I have a textbox and one button in my form. After entering text in textbox I have to click on Ok button. Insted of click on Ok button I want to press enter.