thank you Wjousts
i modifed my code to be like this :
string strRegKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
string path = \\path of my application
RegistryKey regkey = Registry.LocalMachine.CreateSubKey(strRegKey);
regkey.SetValue("sys", path, RegistryValueKind.String);
and then i got exception:
UnauthorizedAccessException
that told my that registry key is read only
so how can i write to this location because many program run when windows startup by writing the path of exe file to this location in registry .
and i tried it manual and it worked but i want to do it in my application .
so can you help me