1 Attachment(s)
Save, Get Settings from ini file [RESOLVED by Edneeis]
I feel a bit embarrased asking too many questions. :blush:
This attached VB6 module;
I used it to Save and Get setting from a INI file.
However, in .NET I found it impossible to use. Upgrading didn't work, and I am not good in API to do a rewrite of the module to work with .NET.
Can you please check the VB6 module and share with me a location where to obtain a similar module which will work with .NET?
Thank you very much,
McoreD. :)
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width - Me.Width
Hi Edneeis,
Everything else works fine :)
I am doing something wrong here:
The following is in my app.Config
PHP Code:
<add key="WindowLeft" value="((System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width - Me.Width) / 2)" />
<add key="WindowTop" value="((System.Windows.Forms.Screen.PrimaryScreen.Bounds.width - Me.height) / 2)" />
When the Form loads, I expect the Form to do this:
VB Code:
Me.Left = AppSettingsManager.LoadAndGetValue("WindowLeft")
Me.Top = AppSettingsManager.LoadAndGetValue("WindowTop")
But I am not getting the expected result and I get the following error instead:
Quote:
Additional information: Cast from string "((System.Windows.Forms.Screen.Pr" to type 'Integer' is not valid.
Hope you released what I was going to do.
Is it possible to pass this kind of information from the XML file to the Form at Form_Load?
Thank you,
McoreD
P.S: It works perfectly if I replace the XML code with (using numbers):
For example:
PHP Code:
<add key="WindowLeft" value="500" />
<add key="WindowTop" value="500" />