Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. My.Settings question

My.Settings question

Scheduled Pinned Locked Moved Visual Basic
helpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sa_runner
    wrote on last edited by
    #1

    I have a setting called bckColor which holds the color for the form I'm using. I want to be able to change that color (and save it) using another page. When the form loads, I use me.backcolor=my.settings.bckColor to set the form's backcolor up. The issue I am having is that the form doesn't always load the color from the My.Settings location. If I had red in the value, run the program and then stop it, manually change the value to blue and run it again, I get red as my backcolor. Am I missing any additional setting in the my.setting area? in the form properties?! Please help me. Thanks.

    J 1 Reply Last reply
    0
    • S sa_runner

      I have a setting called bckColor which holds the color for the form I'm using. I want to be able to change that color (and save it) using another page. When the form loads, I use me.backcolor=my.settings.bckColor to set the form's backcolor up. The issue I am having is that the form doesn't always load the color from the My.Settings location. If I had red in the value, run the program and then stop it, manually change the value to blue and run it again, I get red as my backcolor. Am I missing any additional setting in the my.setting area? in the form properties?! Please help me. Thanks.

      J Offline
      J Offline
      Johan Hakkesteegt
      wrote on last edited by
      #2

      Hi, Me.BackColor = SomeOtherCode.BackColor is always a bit tricky, because even if you are sure that SomeOtherCode is running when your form loads, SomeOtherCode.BackColor may nevertheless not be in memory at that exact moment. Best is to pass SomeOtherCode.BackColor to a public variable when your application starts, then you can easily change the value of that variable on the fly (if necessary). Then Me.BackColor = PublicVariableMyBackGroundColor should work whenever your form loads. Johan

      My advice is free, and you may get what you paid for.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups