pozitron969
Programmer
Hello,
I am trying to read a couple settings from the My.Settings object. I have two settings defined in the Project Properties:
-DefaultApp is a User scope string with an initial value of "Web"
-DefaultTopMost is a User scope boolean with an initial value of False
When I step through the code DefaultApp="Note" and DefaultTopMost=True are the values that are displayed.
I am not setting any of the values in the controls or form definition anywhere else in my code. I am ready to chalk it up to a bug in the Beta of VB.NET. I am almost ready to write my own settings manager, but I really like the idea of the .NET Framework doing this for me. Does anyone know what I am doing wrong?
Thank you very much for your help
Pozitron969
I am trying to read a couple settings from the My.Settings object. I have two settings defined in the Project Properties:
-DefaultApp is a User scope string with an initial value of "Web"
-DefaultTopMost is a User scope boolean with an initial value of False
When I step through the code DefaultApp="Note" and DefaultTopMost=True are the values that are displayed.
I am not setting any of the values in the controls or form definition anywhere else in my code. I am ready to chalk it up to a bug in the Beta of VB.NET. I am almost ready to write my own settings manager, but I really like the idea of the .NET Framework doing this for me. Does anyone know what I am doing wrong?
Thank you very much for your help
Pozitron969
Code:
Public Class frmMain
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
'Call ActivateApp("Web") '<- This works
Call ActivateApp(My.Settings.DefaultApp) '<- This doesn't work
Call SetTopMost(My.Settings.DefaultTopMost)
End Sub
Code:
''' <summary>
''' Set the Applet to be visible and fully docked by name
''' </summary>
''' <param name="sAppName"></param>
''' <remarks>Sets the Applet to be active (visible and fill docked) by name</remarks>
Private Sub ActivateApp(ByRef sAppName As String)
Dim myControl As New Control
For Each myControl In Me.Controls
If myControl.Name = sAppName Then
myControl.Visible = True
myControl.Dock = DockStyle.Fill
Else
myControl.Visible = False
myControl.Dock = DockStyle.None
End If
Next
End Sub
Code:
''' <summary>
''' Set the Main Form to be Top Most (Always on Top)
''' </summary>
''' <param name="bTopMost"></param>
''' <remarks>Pass the input directly to the Main Form</remarks>
Private Sub SetTopMost(ByRef bTopMost As Boolean)
Me.TopMost = bTopMost
End Sub