TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Aniruddha Acharya
NA
304
20.2k
Enable button on only text file select
Nov 20 2017 11:44 PM
Hi,
I want to how to enabled button when
only select .txt file
from browse openFileDialog window .
I am using this code on browse button click .
private void btnBrowse_Click(object sender, RoutedEventArgs e)
{
Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog();
openFileDialog.DefaultExt = ".txt";
openFileDialog.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*";
openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
result = openFileDialog.Filter;
if (openFileDialog.ShowDialog() == true) //Open file dialog window
{
txtpath = openFileDialog.FileName;
FileNameTextBox.Text = txtpath;
btnCompaire.IsEnabled = true; openFileDialog.
}
}
Only for select .txt file . if other any file [.ppt,pdf,...etc] then disabled this button
Thanks
Reply
Answers (
4
)
How to access android Mobile camera on internet ?
Getting response "System.Net.HttpStatusCode.Unauthorized"