Saving the Folder Name in File Open and Save Dialog Box
We can save the Directory name in the File Save Dialog Box, that means when we next time open the Dialog box we can see the Folder name which we have previously opend..
This can be Done by Setting the Registry values.. for this wee need to Include the Microsoft.Win32 name header files in our application
the Above code having the Text box name where we have to display the File Name and the Save file dialog box name..
RegistryKey regKey = Registry.CurrentUser;
regKey = regKey.CreateSubKey("Software\\Test\\EnvVar");
string strTmp = regKey.GetValue("TargetFolder", "").ToString();
SaveFileDialog myDialog = new SaveFileDialog();
myDialog.InitialDirectory = strTmp;
myDialog.Filter = "Excel Files (*.xls)|*.xls";
myDialog.FilterIndex = 1;
myDialog.RestoreDirectory = true;
if (myDialog.ShowDialog() == DialogResult.OK)
{
regKey.SetValue("TargetFolder", txtFileName.Text);
txtFileName.Text = myDialog.FileName;
btnGo.Enabled = true;
}
Thanks
Anil Pandey
Hi Frnd
really its very good article plz keep post such article
Thanks a lot
Shekhar Kadam