473,385 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Problem writing multiple values to registery

6
Hi all i am usiing this code to write mulitiple values to registery but it only write one value. could any one help me make this code so that it write multiple values to registery. Currently it only writes nickname but not pwd value!!
I tried this but gave me error :


Expand|Select|Wrap|Line Numbers
  1.  
  2. 'Save the value to the registry
  3.     SaveString HKEY_CURRENT_USER, "Software\xyz\" + Text6.Text, "nickname",+Text7.Text "pwd", strString
  4.  
  5.  

complete code :


Expand|Select|Wrap|Line Numbers
  1.  
  2. Const REG_SZ = 1 ' Unicode nul terminated string
  3. Const REG_BINARY = 3 ' Free form binary
  4. Const HKEY_CURRENT_USER = &H80000001
  5. Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
  6. Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
  7. Private Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As Long
  8. Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
  9. Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
  10. Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
  11.  
  12.  
  13.  
  14.  
  15. Sub SaveString(hKey As Long, strPath As String, strValue As String, strData As String)
  16.     Dim Ret
  17.     'Create a new key
  18.     RegCreateKey hKey, strPath, Ret
  19.     'Save a string to the key
  20.     RegSetValueEx Ret, strValue, 0, REG_SZ, ByVal strData, Len(strData)
  21.     'close the key
  22.     RegCloseKey Ret
  23. End Sub
  24. Sub SaveStringLong(hKey As Long, strPath As String, strValue As String, strData As String)
  25.     Dim Ret
  26.     'Create a new key
  27.     RegCreateKey hKey, strPath, Ret
  28.     'Set the key's value
  29.     RegSetValueEx Ret, strValue, 0, REG_BINARY, CByte(strData), 4
  30.     'close the key
  31.     RegCloseKey Ret
  32. End Sub
  33.  
  34. Private Sub Command14_Click()
  35. 'Dim strString As String
  36.     Dim strString As String
  37.     'Ask for a value
  38.     'strString = InputBox("Please enter a value to be saved as a binary value in the registry.", App.Title)
  39.  
  40.  
  41.     'Save the value to the registry
  42.  
  43.  
  44.     SaveString HKEY_CURRENT_USER, "Software\xyz\" + Text6.Text, "nickname", strString
  45.  
  46. '    SaveString HKEY_CURRENT_USER, "Software\xyz\" + Text6.Text, "nickname",+Text7.Text, "pwd", strString ===> did not work
  47.  
  48.  
  49. End Sub
  50.  
  51.  
Jun 17 '06 #1
1 1715
sashi
1,754 Expert 1GB
hi method,

try this method.. good luck to u my fren..

SaveString HKEY_CURRENT_USER, "Software\xyz\",trim(Text6.Text), "nickname",(trim(Text7.Text), "pwd", strString
Jun 18 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Leslaw Bieniasz | last post by:
Cracow, 20.09.2004 Hello, I need to implement a library containing a hierarchy of classes together with some binary operations on objects. To fix attention, let me assume that it is a...
7
by: jsale | last post by:
I'm currently using ASP.NET with VS2003 and SQL Server 2003. The ASP.NET app i have made is running on IIS v6 and consists of a number of pages that allow the user to read information from the...
7
by: Brian Henry | last post by:
I am trying to deploy my VB.NET project with a setup project, and I need to make a reg key entry.. but it also needs to have the path to where the program was installed in they string i placed in...
12
by: Chris Springer | last post by:
I'd like to get some feedback on the issue of storing data out to disk and where to store it. I've never been in a production environment in programming so you'll have to bear with me... My...
4
by: a | last post by:
Hi everybody, I have the following setup: - Windows XP Pro with SP2 and all updates installed - Apache 2.054 - PHP 4.4.x (not sure if 1 or 2) My app consists in a html form page which sends...
1
by: method | last post by:
I am trying to delete registery key encluding all its subkeys . I want to delete the bold part HKEY_CURRENT_USER, "Software\xyz\foldername\" using an api that i found on the net but i keep...
10
by: David Thielen | last post by:
Hi; I am trying to write to the event log using: public const string EVENT_LOG_NAME = "Windward Portal"; if (!EventLog.SourceExists(EVENT_LOG_NAME)) EventLog.CreateEventSource(EVENT_LOG_NAME,...
2
by: Jason | last post by:
I've got 20 PC's that I need to change the Description/name field for each NIC, and each PC has three NIC adapters (all PC's are the same Hardware). I know how to change it maunaully in the...
43
by: John | last post by:
Hi This .net is driving me crazy!! In VB6 I had a type which contained a couple of multi-dimentional arrays which i used to create and read records: Type AAA : Array1(10,10,2) as Integer
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.