7 Replies - 3946 Views - Last Post: 18 March 2013 - 11:19 AM Rate Topic: -----

#1 nilesh7136  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 120
  • Joined: 03-January 13

try to change application setting value

Posted 18 March 2013 - 10:13 AM

hello,
i am trying to change application value, because i need it, if the value is true then starting form will be open in full screen, and if 'False' then it will open as simple, i its not work,

please help me ::
my code
  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If My.Settings.Full = True Then

            My.Settings.Full = False
            My.Settings.Save()
            MsgBox("False")

        Else
            My.Settings.Full = True
            My.Settings.Save()
            MsgBox("True")
        End If
        

    End Sub


Thnks,
@nilesh

Is This A Good Question/Topic? 0
  • +

Replies To: try to change application setting value

#2 lar3ry  Icon User is offline

  • Coding Geezer
  • member icon

Reputation: 310
  • View blog
  • Posts: 1,290
  • Joined: 12-September 12

Re: try to change application setting value

Posted 18 March 2013 - 10:33 AM

View Postnilesh7136, on 18 March 2013 - 11:13 AM, said:

hello,
i am trying to change application value, because i need it, if the value is true then starting form will be open in full screen, and if 'False' then it will open as simple, i its not work,

Is My.Settings.Full defined as a Boolean?

At the top of your code, before the Class statement, and above any Iport statements, place the lines:

Option Explicit On
Option Strict On



then re-check your code for any errors (wiggly blue underline on problem lines.

You might also want to place a BreakPoint on the If statement and single-step through to see if it's doing what you want it to do,

Could you also post the code that causes the form to open full or not?
Was This Post Helpful? 1
  • +
  • -

#3 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1605
  • View blog
  • Posts: 5,162
  • Joined: 25-September 09

Re: try to change application setting value

Posted 18 March 2013 - 10:41 AM

Where are you placing the code to size the window and how are you doing it?
Was This Post Helpful? 1
  • +
  • -

#4 nilesh7136  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 120
  • Joined: 03-January 13

Re: try to change application setting value

Posted 18 March 2013 - 10:46 AM

View Postlar3ry, on 18 March 2013 - 10:33 AM, said:

At the top of your code, before the Class statement, and above any Iport statements, place the lines:

Option Explicit On
Option Strict On



then re-check your code for any errors (wiggly blue underline on problem lines.

You might also want to place a BreakPoint on the If statement and single-step through to see if it's doing what you want it to do,

Could you also post the code that causes the form to open full or not?


Option Explicit On
Option Strict On
Public Class Form1
    Dim data As String

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If My.Settings.Full = True Then
            My.Settings.Full = False
            My.Settings.Save()
        Else
            My.Settings.Full = True
            My.Settings.Save()
        End If
        Me.Refresh()
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        If My.Settings.Full = True Then
            Me.StartPosition = FormStartPosition.CenterScreen
            Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
            Me.WindowState = FormWindowState.Maximized
        Else
            Me.FormBorderStyle = Windows.Forms.FormBorderStyle.Sizable
            Me.StartPosition = FormStartPosition.Manual
            Me.WindowState = FormWindowState.Normal
        End If
    End Sub
End Class


This is My Full Code
Hey dude, its work properly, but when i see on property-setting there still same value, no changes occure,, whats that??
Was This Post Helpful? 0
  • +
  • -

#5 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1605
  • View blog
  • Posts: 5,162
  • Joined: 25-September 09

Re: try to change application setting value

Posted 18 March 2013 - 10:52 AM

That's because it's being written in the .config file that's being created alongside your executable.

If you go to where your executable is, you should find a file called
{yourexecutablename}.exe.config

That is where your settings are being stored for the application.

The settings tab is for setting up those settings but doesn't change as the setting in the .config change.

This post has been edited by CharlieMay: 18 March 2013 - 10:55 AM

Was This Post Helpful? 1
  • +
  • -

#6 nilesh7136  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 120
  • Joined: 03-January 13

Re: try to change application setting value

Posted 18 March 2013 - 11:03 AM

View PostCharlieMay, on 18 March 2013 - 10:52 AM, said:

That's because it's being written in the .config file that's being created alongside your executable.

If you go to where your executable is, you should find a file called
{yourexecutablename}.exe.config

That is where your settings are being stored for the application.

The settings tab is for setting up those settings but doesn't change as the setting in the .config change.

ohhhh, got it, Thanks a lot for helping :)
Was This Post Helpful? 0
  • +
  • -

#7 lar3ry  Icon User is offline

  • Coding Geezer
  • member icon

Reputation: 310
  • View blog
  • Posts: 1,290
  • Joined: 12-September 12

Re: try to change application setting value

Posted 18 March 2013 - 11:03 AM

Just to expand a bit on what CharlieMay said....

If you make a ListBox, then in Properties, you type some lines into the Items (Collection) property, when you run the program, those lines will show up in the ListBox, You can change them in the program, but when you go to run it again, the original lines you put in are still there.

Good to hear your program is working. It's working as it should.
Was This Post Helpful? 1
  • +
  • -

#8 AdamSpeight2008  Icon User is online

  • MrCupOfT
  • member icon


Reputation: 2241
  • View blog
  • Posts: 9,414
  • Joined: 29-May 08

Re: try to change application setting value

Posted 18 March 2013 - 11:19 AM

If the scope of the setting is Application you can't affect it, because it read-only.

Using Settings Tutorial
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1