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. SOS of all SOS'es

SOS of all SOS'es

Scheduled Pinned Locked Moved Visual Basic
helpquestion
5 Posts 3 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.
  • N Offline
    N Offline
    NANCO
    wrote on last edited by
    #1

    :(I'm using this code to save the settings: SaveSetting("program", "programSettings", "bgcolor", textbox1.BackColor = ColorDialog1.Color) I'm using this code to get the settings dim a$ = getSetting("program", "programSettings", "bgcolor") then I used this code to assign the settings back: me.textbox1.BackColor = new color(a) :confused:obviously it doesn't work! can anyone help me? extremely argent my project is at a halt.:doh:

    C W 2 Replies Last reply
    0
    • N NANCO

      :(I'm using this code to save the settings: SaveSetting("program", "programSettings", "bgcolor", textbox1.BackColor = ColorDialog1.Color) I'm using this code to get the settings dim a$ = getSetting("program", "programSettings", "bgcolor") then I used this code to assign the settings back: me.textbox1.BackColor = new color(a) :confused:obviously it doesn't work! can anyone help me? extremely argent my project is at a halt.:doh:

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      NANCO wrote:

      SaveSetting("program", "programSettings", "bgcolor", Text1.BackColor = ColorDialog1.Color)

      This looks to me like it would save a boolean, the result of checking if textbox1.BackColor is the same value as ColorDialog1.Color. This is an artefact of VB being crap, sorry. Or, I am wrong, I could be. What happens when you step through the code ? Why do you have an assignment ( or equality check, how do you tell the difference in VB ? ), inside the Save code ? Surely your variables are not called Text1 and ColorDialog1, REALLY ???

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      N 1 Reply Last reply
      0
      • C Christian Graus

        NANCO wrote:

        SaveSetting("program", "programSettings", "bgcolor", Text1.BackColor = ColorDialog1.Color)

        This looks to me like it would save a boolean, the result of checking if textbox1.BackColor is the same value as ColorDialog1.Color. This is an artefact of VB being crap, sorry. Or, I am wrong, I could be. What happens when you step through the code ? Why do you have an assignment ( or equality check, how do you tell the difference in VB ? ), inside the Save code ? Surely your variables are not called Text1 and ColorDialog1, REALLY ???

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

        N Offline
        N Offline
        NANCO
        wrote on last edited by
        #3

        I don't know; I just got the code, it doesn't work. I will put it simply, can anyone tell me how to save and retrieve a BackColor, so I can assign it back on startup.:|

        C 1 Reply Last reply
        0
        • N NANCO

          :(I'm using this code to save the settings: SaveSetting("program", "programSettings", "bgcolor", textbox1.BackColor = ColorDialog1.Color) I'm using this code to get the settings dim a$ = getSetting("program", "programSettings", "bgcolor") then I used this code to assign the settings back: me.textbox1.BackColor = new color(a) :confused:obviously it doesn't work! can anyone help me? extremely argent my project is at a halt.:doh:

          W Offline
          W Offline
          Werries
          wrote on last edited by
          #4

          Hi there, The statement 'textbox1.BackColor = ColorDialog1.Color' generates a boolen value, not the value of the color code. Do it as follow: TextBox1.BackColor = ColorDialog1.Color ' Save to registry SaveSetting("program", "programSettings", "bgcolor", TextBox1.BackColor.ToArgb) ' Apply from registry Me.TextBox1.BackColor = Drawing.Color.FromArgb(GetSetting("program", "programSettings", "bgcolor")) Regards, Werries

          A programmer's life is good... or is it?? Ek dink nie so nie!

          1 Reply Last reply
          0
          • N NANCO

            I don't know; I just got the code, it doesn't work. I will put it simply, can anyone tell me how to save and retrieve a BackColor, so I can assign it back on startup.:|

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            NANCO wrote:

            I don't know; I just got the code, it doesn't work.

            Getting code off the web is fine, so long as you're able to understand it. If you can't understand it, then you should stop and work through a book, so you know enough VB.NET that the web helps you with syntax, not with writing code. To store a color, you'd probably store the red, green and blue components as integers, then you'd use those to create a color again.

            Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

            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