Hello !

VB Code:
  1. Public Sub SearchString()
  2. regkey = "Software\My Software"
  3. strname = Form1.text1.Text
  4. lngresult = RegOpenKeyEx(HKEY_CURRENT_USER, regkey, REG_SZ, keyallaccess, path)
  5. If lngresult = 0 Then
  6.    lngresult=RegSetValueEx (path, "Search Now", 0, REG_SZ, ByVal strname, Len(strname)
  7. End If
  8. lngresult = RegCloseKey(path)
  9. Exit Sub

Now assume Text1 has no text. A blank text box.

when we execute SearchString() the Strname will be > strname=""

Problem is :

RegSetValueEx returns 87 in Windows98Se. So the function fail to set the value data.

RegSetValueEx returns 0 successfully on XP and 2K.

Friends! What is the problem?