summey
April 26th, 2009, 02:16 PM
I have my code it works i get back the registry value but what i want to do is
check to see if its empty if its empty ok to install program
if not would you like to remove the registry value?
here is my code it dosnt work if i put somthing in the reg value and run my program it dosnt check
if i remove the data from that value same results.
how can i set this up below is my code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Win32;
namespace regMod
{
class Program
{
static void Main(string[] args)
{
RegistryKey MyReg = Registry.LocalMachine.OpenSubKey
("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\setup.exe", true);
try
{
string IsVal = (string)MyReg.GetValue("Default", "");
Console.WriteLine(MyReg.GetValue(IsVal).ToString());
if (IsVal == null)
{
Console.WriteLine("ok to install");
}
else
{
Console.WriteLine("Remove key value data?");
}
}
thank you for your time
-summey
check to see if its empty if its empty ok to install program
if not would you like to remove the registry value?
here is my code it dosnt work if i put somthing in the reg value and run my program it dosnt check
if i remove the data from that value same results.
how can i set this up below is my code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Win32;
namespace regMod
{
class Program
{
static void Main(string[] args)
{
RegistryKey MyReg = Registry.LocalMachine.OpenSubKey
("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\setup.exe", true);
try
{
string IsVal = (string)MyReg.GetValue("Default", "");
Console.WriteLine(MyReg.GetValue(IsVal).ToString());
if (IsVal == null)
{
Console.WriteLine("ok to install");
}
else
{
Console.WriteLine("Remove key value data?");
}
}
thank you for your time
-summey