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
kartik k
1.6k
181
424
Need single control for save and opening a file in WPF
Nov 19 2019 12:18 AM
Assuming there will be only one (.log) file
Say if user selects the path ex:(c:\test) and if the .log file exist then it should return c:\test\xyz.log.
if file not exist then in the same control user should specify the file name and it should be saved in the path in .log extension.
The below is the code :
string logFileName = string.Empty;
FolderBrowserDialog fbd = new FolderBrowserDialog();
if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
logFileName = CheckLogFile(fbd.SelectedPath);
else
return;
if (!string.IsNullOrEmpty(logFileName))
LogFileName = Path.Combine(fbd.SelectedPath, logFileName);
else
{
Microsoft.Win32.SaveFileDialog sfd = new Microsoft.Win32.SaveFileDialog();
if (sfd.ShowDialog() == true)
{
LogFileName = sfd.FileName;
}
}
Any help?
Reply
Answers (
1
)
How to extract a data from a method and download it
Page Scrapping [ getting Incomplete Page Source ! ]