Click here to Skip to main content
16,017,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello
iam developing win application for retrive the image from system location and converting into text file and save into system location this is my work. i want to accept the changes of app.config file after instalation.here user modify the app.config file parameter value(here mention the drive address) ,that means with out compilation the exe accept changes in that remote system.for example iam created one winapp setup file and deployee in one system.
aftrer he change the app.config file parameter(this containing system drive location) at that time my application accept that drive address and do iamge process.

i have an idea for fixed location in system
my code is(This is peace of from total code)
<appSettings>
    <add key="SQLCN" value="Data Source=localhost;Initial Catalog=MyDB;Integrated Security=True" />
    <add key="IMGFOLDER" value="D:\\ImageFolder"/>
    <add key="SaveImagefolderPath" value="D:\\SaveImageOutPutFolder" /  </appSettings>

C#
string fldr = ConfigurationSettings.AppSettings["IMGFOLDER"];
Formload()
{
NewImageFolderCreation();
PopulateTreeview();

}
btnImagesave()
{
SaveImageAfterConvertion();

}
 private void NewImageFolderCreation()
        {
            if (!System.IO.Directory.Exists(fldr))
            {
                System.IO.Directory.CreateDirectory(fldr);
                MessageBox.Show("folder created");
            }
            else
            {
                MessageBox.Show("ImageFolder is available populate images into folder");
            }
        }  
private void POpulateTreeview()
        {
            DirectoryInfo info = new DirectoryInfo(fldr);
            TreeNode root = new TreeNode(info.Name);
            root.Text = "";
            //eng = OcrEngineManager.CreateEngine(OcrEngineType.Professional, false);
            //eng.Startup(null, null, null, null);
            TreeNode node = new TreeNode();
            TrvImageFile.Nodes.Add(root);
            FileInfo[] subfileinfo = info.GetFiles("*.*");
            if (subfileinfo.Length > 0)
            {
                for ( j = 0; j < subfileinfo.Length; j++)
                {
                    root.Nodes.Add(subfileinfo[j].Name);
                }
            }
            TrvImageFile.ExpandAll();
        }
SaveImageAfterConvertion()
{
if (!System.IO.Directory.Exists(fldr))
            {
                System.IO.Directory.CreateDirectory(fldr);
                doc.Save(ConfigurationSettings.AppSettings["SaveImagefolderPath"] + "\\"+Newtxtfilename+".txt", Leadtools.Forms.DocumentWriters.DocumentFormat.Text, null);
                MessageBox.Show("folder created and image output saved");
            }
            else
            {
                doc.Save(ConfigurationSettings.AppSettings["SaveImagefolderPath"] + "\\"+Newtxtfilename+".txt", Leadtools.Forms.DocumentWriters.DocumentFormat.Text, null);
                MessageBox.Show("ImageFolder is available  images are  Saved into folder Now");
            }    
}

Any Body give good example on this.
where in my code i want to do modifications to accept changes of exe file.

[edit]Code block added, "Treat my content as plain text..." option disabled - OriginalGriff[/edit]
Posted
Updated 18-Aug-11 21:59pm
v4

1 solution

Replace the "D:\\SaveImageOutPutFolder" with a appliciation configuration string:
1) Open your projects Properties in the solution explorer, and double click on "Settings.settings"
2) In the resulting grid, change the Name to "MySetting", and set the Value to "D:\\SaveImageOutPutFolder". Leave Type and Scope as "string" and "User" respectively.
3) Save and close the settings window.
4) To read your setting:
string s = Properties.Settings.Default.MySetting;
5) To write your setting:
Properties.Settings.Default.MySetting = "My new setting value";
Properties.Settings.Default.Save();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900