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
Printable View
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
Take a look at the SaveSetting/GetSetting example in my signature.
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
For example: place one TextBox on your form (with a name Text1). Then try this code:
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.VB Code:
Private Sub Form_Load() 'to get the value on load - if no value was saved before, 'Text1.Text will equal vbNullString - the default value Text1.Text = GetSetting("myApp", "Settings", "TextBox", vbNullString) End Sub Private Sub Form_Unload(Cancel As Integer) 'to save the value on unload SaveSetting "myApp", "Settings", "TextBox", Text1.Text End Sub
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