D
dxe2dsf
Guest
Hello,
I have a project i'm working on, I have everything working except the return of string array's
and byte array's showing where I want them to show. I have them returning to a list box, but I want
them to show in the text box where the ( string, expand string, DWord, QWord ) show. But I just
can't figure that part out.
Here is what I use in my project :
// The code for the GetValue Method
// =============== MainForm.cs =====================
private string[] MS_Array = new string[] { };
private byte[] B_Array = new byte[] { };
private void BtnRefreshValueClick(object sender, EventArgs e)
{
this.TxtValue.Text = this.SelectedProfile.GetValue(this.CboSection.Text, this.CboEntry.Text, "");
}
private void TxtValue_TextChanged(object sender, EventArgs e)
{
this.UpdateComponents();
try
{
if (TxtValue.Text == "System.String[]")
{
listBox1.Items.Clear();
listBox1.Items.Add("This is the Multi-String value");
listBox1.Items.Add("");
string[] value = this.SelectedProfile.GetValue(this.CboSection.Text, this.CboEntry.Text, MS_Array);
for (int i = 0; i < value.Length; i++)
{
listBox1.Items.Add(string.Concat(value));
}
}
}
catch { }
try
{
if (TxtValue.Text == "System.Byte[]")
{
listBox1.Items.Clear();
listBox1.Items.Add("This is the Binary value");
listBox1.Items.Add("");
byte[] value = this.SelectedProfile.GetValue(this.CboSection.Text, this.CboEntry.Text, B_Array);
for (int i = 0; i < value.Length; i++)
{
listBox1.Items.Add(string.Concat( "CHAR = " + (char)value + " DEC = " + value));
}
}
}
catch { }
}
// ============ Profile.cs ==============
public abstract object GetValue(string section, string entry);
public virtual string[] GetValue(string section, string entry, string[] defaultValue)
{
object value = this.GetValue(section, entry);
if (value == null)
{
return defaultValue;
}
return (string[])value;
}
public virtual byte[] GetValue(string section, string entry, byte[] defaultValue)
{
object value = this.GetValue(section, entry);
if (value == null)
{
return defaultValue;
}
return (byte[])value;
}
// ================ Registry.cs =================
public override object GetValue(string section, string entry)
{
object obj;
this.VerifyAndAdjustSection(ref section);
this.VerifyAndAdjustEntry(ref entry);
using (Microsoft.Win32.RegistryKey subKey = this.GetSubKey(section, false, false))
{
obj = (subKey?.GetValue(entry));
}
return obj;
}
I need to know how to return the string array and byte array to the TxtValue.Text
Here is a link to my project :
Registry Utility
Please help
Thank you
Continue reading...
I have a project i'm working on, I have everything working except the return of string array's
and byte array's showing where I want them to show. I have them returning to a list box, but I want
them to show in the text box where the ( string, expand string, DWord, QWord ) show. But I just
can't figure that part out.
Here is what I use in my project :
// The code for the GetValue Method
// =============== MainForm.cs =====================
private string[] MS_Array = new string[] { };
private byte[] B_Array = new byte[] { };
private void BtnRefreshValueClick(object sender, EventArgs e)
{
this.TxtValue.Text = this.SelectedProfile.GetValue(this.CboSection.Text, this.CboEntry.Text, "");
}
private void TxtValue_TextChanged(object sender, EventArgs e)
{
this.UpdateComponents();
try
{
if (TxtValue.Text == "System.String[]")
{
listBox1.Items.Clear();
listBox1.Items.Add("This is the Multi-String value");
listBox1.Items.Add("");
string[] value = this.SelectedProfile.GetValue(this.CboSection.Text, this.CboEntry.Text, MS_Array);
for (int i = 0; i < value.Length; i++)
{
listBox1.Items.Add(string.Concat(value));
}
}
}
catch { }
try
{
if (TxtValue.Text == "System.Byte[]")
{
listBox1.Items.Clear();
listBox1.Items.Add("This is the Binary value");
listBox1.Items.Add("");
byte[] value = this.SelectedProfile.GetValue(this.CboSection.Text, this.CboEntry.Text, B_Array);
for (int i = 0; i < value.Length; i++)
{
listBox1.Items.Add(string.Concat( "CHAR = " + (char)value + " DEC = " + value));
}
}
}
catch { }
}
// ============ Profile.cs ==============
public abstract object GetValue(string section, string entry);
public virtual string[] GetValue(string section, string entry, string[] defaultValue)
{
object value = this.GetValue(section, entry);
if (value == null)
{
return defaultValue;
}
return (string[])value;
}
public virtual byte[] GetValue(string section, string entry, byte[] defaultValue)
{
object value = this.GetValue(section, entry);
if (value == null)
{
return defaultValue;
}
return (byte[])value;
}
// ================ Registry.cs =================
public override object GetValue(string section, string entry)
{
object obj;
this.VerifyAndAdjustSection(ref section);
this.VerifyAndAdjustEntry(ref entry);
using (Microsoft.Win32.RegistryKey subKey = this.GetSubKey(section, false, false))
{
obj = (subKey?.GetValue(entry));
}
return obj;
}
I need to know how to return the string array and byte array to the TxtValue.Text
Here is a link to my project :
Registry Utility
Please help
Thank you
Continue reading...