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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. How to store variables in C# exe file?

How to store variables in C# exe file?

Scheduled Pinned Locked Moved C#
csharptutorialquestion
3 Posts 3 Posters 3 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
    sbscb
    wrote on last edited by
    #1

    I want to store dynamic variables in a exe file (C#), that I can access [mostly just strings] to read or write. I was using the Application Settings class but it apparently saves the files in Application Data but I want my exe to take the values from the form and write them to itself or store them inside the executable file so that when I send the file to someone else it will have the preferences stored without having to do anything. If this is not possible is there any way of making a C# builder application that will ask for variables and then create a new exe file with the variables pre-stored? Thanks :)

    M D 2 Replies Last reply
    0
    • S sbscb

      I want to store dynamic variables in a exe file (C#), that I can access [mostly just strings] to read or write. I was using the Application Settings class but it apparently saves the files in Application Data but I want my exe to take the values from the form and write them to itself or store them inside the executable file so that when I send the file to someone else it will have the preferences stored without having to do anything. If this is not possible is there any way of making a C# builder application that will ask for variables and then create a new exe file with the variables pre-stored? Thanks :)

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      Take a look at this thread[^], it may help

      Never underestimate the power of human stupidity RAH

      1 Reply Last reply
      0
      • S sbscb

        I want to store dynamic variables in a exe file (C#), that I can access [mostly just strings] to read or write. I was using the Application Settings class but it apparently saves the files in Application Data but I want my exe to take the values from the form and write them to itself or store them inside the executable file so that when I send the file to someone else it will have the preferences stored without having to do anything. If this is not possible is there any way of making a C# builder application that will ask for variables and then create a new exe file with the variables pre-stored? Thanks :)

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        You're much better off keeping those values in a seperate file. You cannot write to an .EXE file that is still running. Not to mention the problems with finding the values in the binary file and CAREFULLY writing the news back so you don't screw up anything around it.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007, 2008

        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