You might be trying to modify TrustedInstaller keys. TrustedInstaller is a special user that has power beyond that of Administrator(s). You will need to take ownership of the key in order to work around that (completely ruining the security on your user's machine). If you need to change keys owned by TrustedInstaller you are doing something very very wrong.
If you are not trying to modify TrustedInstaller-owned keys you probably need to indicate which permissions you want when you open the key:
using (var key = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Foo\\Bar", RegistryKeyPermissionCheck.ReadWriteSubTree))
// .. or ..
using (var key = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Foo\\Bar", RegistryKeyPermissionCheck.ReadWriteSubTree))
He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chinese Proverb]
I am currently a student in TYBSC(IT) so I had a query that in C# windows form If for example a clientname combobox is there and on selecting the client Name in the combobox the 2 text boxes clientAddress and ClientNumber should be retrieved from the database and get filled in the textboxes.
Sir please help me in my project my mailing me a demo program so that I can Find A Solution to It.
Please Sir and as sson as possible as jan end is ma submission date
publicpartialclass Form1 : Form
string Id = "";
string Address = "";
privatevoid Form1_Load(object sender, EventArgs e)
// TODO: This line of code loads data into the 'database1DataSet1.Test' table. You can move, or remove it, as needed.
privatevoid comboBox1_SelectedIndexChanged(object sender, EventArgs e)
string SelectedId = Convert.ToString(comboBox1.SelectedValue);
if (Convert.ToString(comboBox1.SelectedValue) != "")
database1DataSet1.DataSource = Database1DataSet1TableAdapters.GetData(int.Parse(SelectedId));
var Id = from r in testTableAdapter.GetData()
where r["Id"].ToString() == SelectedId
var Address = from r in testTableAdapter.GetData()
where r["ProductId"].ToString() == SelectedId
foreach (var unit in Id)
Id = id.ToString();
foreach (var measure in Name)
ProductMeasure = measure.ToString();
textBox1.Text = Id;