BUG: "Out of memory" error if you sse the GetSetting function to retrieve an empty string from the registry in Visual Basic .NET and in Visual Basic 6.0 (814606)
The information in this article applies to:
- Microsoft Visual Basic .NET (2003)
- Microsoft Visual Basic .NET (2002)
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
SYMPTOMSIf you store an empty string in the registry by using the SaveSetting function in Microsoft Visual Basic .NET, and then you retrieve
the same empty string value by using the GetSetting function in Microsoft Visual Basic 6.0, you may receive the
following error message: Run-time error '7': Out of memory
CAUSEThe SaveSetting function creates a registry key with the value provided as a
parameter. The Visual Basic .NET SaveSetting function writes a value of zero bytes in the registry to
represent an empty string. However, the Visual Basic 6.0 SaveSetting function or Registry Editor stores a two-byte NULL character in
the registry for the empty string. The Visual Basic 6.0 GetSetting function also expects a two-byte NULL character for the empty
string value. An error occurs while the application reads the string value from
the registry, because the Visual Basic 6.0 GetSetting function receives zero-byte data instead of a two-byte NULL
character.WORKAROUNDTo work around this problem, pass a vbNullChar as a parameter for the key value to the Visual Basic .NET SaveSetting function, instead of passing an empty string.STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.
Modification Type: | Minor | Last Reviewed: | 2/3/2006 |
---|
Keywords: | kbvs2005swept kbvs2005doesnotapply kbvs2002sp1sweep kbRegistry kbMigration kbString kbbug KB814606 kbAudDeveloper |
---|
|