Matching Text with Image name
Sir I want to match or compare text which is in registry with the image name stored in local app data directory.How can i do that?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Posted Jul 30, 2014, 8:44 AM
You can use Exist function of File class to know whether the file is is exist or not
string filename;
string KeyName="your registry key name where your text exist";
// Opening the registry key
RegistryKey rk = baseRegistryKey ;
// Open a subKey as read-only
RegistryKey sk1 = rk.OpenSubKey(subKey);
// If the RegistrySubKey doesn't exist -> (null)
if ( sk1 == null )
{
filename=null;
}
else
{
try
{
// If the RegistryKey exists I get its value // or null is returned.
filename= (string)sk1.GetValue(KeyName.ToUpper());
}
catch (Exception e)
{
// AAAAAAAAAAARGH, an error!
MessageBox.Show(e, "Reading registry " + KeyName.ToUpper());
}
}
if(File.Exists("full path")==true)
{
MessageBox.Show("File Exists");
}
else
{
MessageBox.Show("File not Exists");
}
Kindly mark as answer, if above helps you
Thanks,
Kailash