Results 1 to 5 of 5

Thread: can i edit registery?, add variables of my own.

  1. #1

    Thread Starter
    Addicted Member Incures's Avatar
    Join Date
    May 2006
    Location
    south afrika
    Posts
    205

    can i edit registery?, add variables of my own.

    hi all if i wanna add my one variable to the registery?
    and i wanna to do it by VB software not *.key file...thx

  2. #2

  3. #3

    Thread Starter
    Addicted Member Incures's Avatar
    Join Date
    May 2006
    Location
    south afrika
    Posts
    205

    Re: can i edit registery?, add variables of my own.

    i saw it but i dident understand...thats the problem T_T
    please cna u give me exaple like...
    if i want to make and variable that in
    "HKEY_CURRENT_USER\Software\mysoftware\ID"
    to make and ID variable and to put in it "Login

  4. #4
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: can i edit registery?, add variables of my own.

    For example: place one TextBox on your form (with a name Text1). Then try this code:

    VB Code:
    1. Private Sub Form_Load()
    2.  
    3.     'to get the value on load - if no value was saved before,
    4.     'Text1.Text will equal vbNullString - the default value
    5.     Text1.Text = GetSetting("myApp", "Settings", "TextBox", vbNullString)
    6.    
    7. End Sub
    8.  
    9. Private Sub Form_Unload(Cancel As Integer)
    10.  
    11.     'to save the value on unload
    12.     SaveSetting "myApp", "Settings", "TextBox", Text1.Text
    13.    
    14. End Sub
    Run it once, type something, then stop the program. Then run it again. If everything works as it should, Text1.Text will equal what you wrote before.

  5. #5
    Hyperactive Member Jenova's Avatar
    Join Date
    Feb 2006
    Location
    Googleplex
    Posts
    413

    Re: can i edit registery?, add variables of my own.

    SaveSetting and GetSetting stores information in HKEY_CURRENT_USER|Software|VB and VBA Program Settings part of the registry.

    If you want store information in different parts of the registry then you will need to use the Windows API. The main ones you will need to create/delete keys will be

    RegCreateKeyEx
    RegDeleteKey
    RegCloseKey
    RegOpenKeyEx
    RegQueryValueEx
    RegDeleteValue

    There is an example module written in VB by Microsoft that is shipped with VB. I can't give an example because i am not to sure how to use them either but some should be able to tell you.

    You should check out AllApi

    Hope this helps

    Jenova

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width