Click here to Skip to main content
16,007,843 members
Home / Discussions / Visual Basic
   

Visual Basic

 
JokeRe: problem with drawstring somewhere Pin
ChandraRam9-Jan-08 20:57
ChandraRam9-Jan-08 20:57 
GeneralRe: problem with drawstring somewhere Pin
vbbeg9-Jan-08 22:19
vbbeg9-Jan-08 22:19 
GeneralRe: problem with drawstring somewhere Pin
ChandraRam9-Jan-08 22:23
ChandraRam9-Jan-08 22:23 
GeneralRe: problem with drawstring somewhere Pin
vbbeg9-Jan-08 22:55
vbbeg9-Jan-08 22:55 
QuestionRegistry Access Problem Pin
psgeorge9-Jan-08 7:49
psgeorge9-Jan-08 7:49 
GeneralRe: Registry Access Problem Pin
Dave Kreskowiak9-Jan-08 7:59
mveDave Kreskowiak9-Jan-08 7:59 
GeneralRe: Registry Access Problem Pin
psgeorge10-Jan-08 1:35
psgeorge10-Jan-08 1:35 
QuestionRe: Registry Access Problem Pin
psgeorge11-Jan-08 1:51
psgeorge11-Jan-08 1:51 
Dave,

After reading your response, I went back and did some digging and reqrote my code. However, i still seem to be having the same basic problem. I feel like I'm dancing all around the solution, but I just am not finding it. Here is the new code...

Imports Microsoft.Win32<br />
<br />
Public Class frmMain<br />
<br />
  Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
<br />
    ' Set regKey to point to HKEY_LOCAL_MACHINE<br />
    regKey = Registry.LocalMachine<br />
    ' Create regSubKey to point to HKEY_LOCAL_MACHINE\Software\Liebert\RegistryTest<br />
    regSubKey = regKey.OpenSubKey("Software\Liebert\RegistryTest", True)<br />
    ' Check if registry SubKey exists<br />
    If (regSubKey Is Nothing) Then  ' create SubKey<br />
      regSubKey = regKey.CreateSubKey("Software\Liebert\RegistryTest")<br />
      regSubKey.SetValue("pName", txtInitPortName.Text)<br />
      regSubKey.SetValue("pBaud", txtInitPortBaud.Text)<br />
      ' Restart the application to make use of the new value pName<br />
      MsgBox("Registry entries created!" & vbCrLf & "Application needs restarted!", MsgBoxStyle.OkOnly)<br />
      End<br />
    Else  ' pName exists already, use it !<br />
      txtPortName.Text = regSubKey.GetValue("pName")<br />
      txtPortBaud.Text = regSubKey.GetValue("pBaud")<br />
    End If<br />
<br />
  End Sub<br />
<br />
  Private Sub mnuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuExit.Click<br />
<br />
    End<br />
<br />
  End Sub<br />
End Class


Again, I want my windows application to be run by myself the first time (as Admin on the machine). The application will check for the existence of the registry SubKey and if it does not exist (which it won't), it will create the SubKey (and also a couple of sample values just to see that it works. After creating the SubKey, the application will force a exit and I restart the application. This time, the registry SubKey exists and all the code does is to get the two values.

txtPortName.Text = regSubKey.GetValue("pName")
txtPortBaud.Text = regSubKey.GetValue("pBaud")

This all works fine for me as the user (Admin).

Now, I logoff and have someone else logon as a normal user. He then starts the application (the registry exists. He gets the following exception and does not read the values.

Note: I actually wanted to paste the messagebox in here for the exception, but couldn't figure out how.

Application attempted to perform an operation not allowed by the security policy. To grant this application the required permission, contact your system administrator, or use the Microsoft .NET Framework configuration tool.
If you click continue, the application will ignore the error and attampt to continue. If you click Quit, the application will quit immedately.
Requested registry access is not allowed.



In your previousmessage response, I thought that you implied that the normal user would be able to read the SubKey's values. Obviously, I'm missing something.
GeneralRe: Registry Access Problem Pin
Dave Kreskowiak11-Jan-08 12:15
mveDave Kreskowiak11-Jan-08 12:15 
GeneralRe: Registry Access Problem Pin
psgeorge14-Jan-08 0:18
psgeorge14-Jan-08 0:18 
QuestionDraw a graph in VB.NET Pin
Yatish Kasa9-Jan-08 6:51
Yatish Kasa9-Jan-08 6:51 
GeneralRe: Draw a graph in VB.NET Pin
Dave Kreskowiak9-Jan-08 7:01
mveDave Kreskowiak9-Jan-08 7:01 
Generalwriting function in vb.net Pin
chandra_779-Jan-08 6:18
chandra_779-Jan-08 6:18 
GeneralRe: writing function in vb.net Pin
Dave Kreskowiak9-Jan-08 6:59
mveDave Kreskowiak9-Jan-08 6:59 
GeneralRe: writing function in vb.net Pin
chandra_779-Jan-08 8:02
chandra_779-Jan-08 8:02 
GeneralContract specifications and DLL's and debuggers. Pin
cdansreau9-Jan-08 5:48
cdansreau9-Jan-08 5:48 
GeneralRe: Contract specifications and DLL's and debuggers. Pin
Dave Kreskowiak9-Jan-08 6:55
mveDave Kreskowiak9-Jan-08 6:55 
GeneralRe: Contract specifications and DLL's and debuggers. Pin
cdansreau10-Jan-08 5:34
cdansreau10-Jan-08 5:34 
GeneralRe: Contract specifications and DLL's and debuggers. Pin
Dave Kreskowiak10-Jan-08 13:07
mveDave Kreskowiak10-Jan-08 13:07 
GeneralStill struggling with appdomain Pin
cstrader2329-Jan-08 5:35
cstrader2329-Jan-08 5:35 
GeneralExtract icon from dropdown Pin
cstrader2329-Jan-08 4:33
cstrader2329-Jan-08 4:33 
GeneralRe: Extract icon from dropdown Pin
Dave Kreskowiak9-Jan-08 4:48
mveDave Kreskowiak9-Jan-08 4:48 
GeneralRe: Extract icon from dropdown Pin
cstrader2329-Jan-08 5:30
cstrader2329-Jan-08 5:30 
GeneralRe: Extract icon from dropdown Pin
Dave Kreskowiak9-Jan-08 6:49
mveDave Kreskowiak9-Jan-08 6:49 
QuestionPlease help with Error in VB.Net Code :-( Pin
Support1239-Jan-08 3:13
Support1239-Jan-08 3:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.