473,503 Members | 3,715 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Visual Basic .NET 2008 registry GetValue exception - what wrong?

Hi!

Situation:

simple code read registry value (OpenSubKey -GetValue, as usual).
Requested value exists in registry and has type DWORD, read into the
variable UInt32, access rights granted.

When value's data is in interval &H0 - &H7FFFFFFF - it's works fine. When
value's data has "sign bit rised" (&HF0000000 - &HFFFFFFFF) - arithmetic
operation exception occurs (overflow).

Question is: is it a bug in Microsoft.VisualBasic.dll or just stupid error
in registry usage?
WBR, Andre Klimov
Aladdin Knowledge Systems
Israel

PS
VS2008 Team Suite v9.0.21022.8 RTM (MSDN downloaded), standard installation

PPS
Sorry for simple question - I'm beginner and start use VB.NET only 3 days
before...
Mar 31 '08 #1
2 2357
It's actually a problem in the .NET framework When the registry key type is
REG_DWORD they use an Int32
in RegistryKey.InternalGetValue

So you need to use an Int32 (aka Integer), not an unsigned one.

"Andre Klimov" <Andre Kl****@discussions.microsoft.comwrote in message
news:96**********************************@microsof t.com...
Hi!

Situation:

simple code read registry value (OpenSubKey -GetValue, as usual).
Requested value exists in registry and has type DWORD, read into the
variable UInt32, access rights granted.

When value's data is in interval &H0 - &H7FFFFFFF - it's works fine. When
value's data has "sign bit rised" (&HF0000000 - &HFFFFFFFF) - arithmetic
operation exception occurs (overflow).

Question is: is it a bug in Microsoft.VisualBasic.dll or just stupid error
in registry usage?
WBR, Andre Klimov
Aladdin Knowledge Systems
Israel

PS
VS2008 Team Suite v9.0.21022.8 RTM (MSDN downloaded), standard
installation

PPS
Sorry for simple question - I'm beginner and start use VB.NET only 3 days
before...
Mar 31 '08 #2
Thank you very much!

WBR,

"Bill McCarthy" wrote:
It's actually a problem in the .NET framework When the registry key type is
REG_DWORD they use an Int32
in RegistryKey.InternalGetValue

So you need to use an Int32 (aka Integer), not an unsigned one.

Mar 31 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
17695
by: Bo | last post by:
I am using RegistryKey.GetValue() method to retrieve values from Windows Registry. I don't know how to read type REG_MULTI_SZ into a string array. I have tried string array = (string)...
6
17707
by: Bry | last post by:
I'm having problems writing (and reading) boolean data to the registry. // Write a boolean value to the registry // I've not included the obvious bits of code in these samples bool myBool =...
3
1395
by: Martin | last post by:
Hi I am attempting to write a small application that will allow users to manage the AddressBar entries within Internet Explorer. The typed URLs in the AddressBar can be found at...
11
2205
by: Larry Bird | last post by:
I'm trying to read a registry key using VB.Net. I have posted the code below that I'm using: Dim DBConnect As RegistryKey = Registry.CurrentUser.OpenSubKey _ ("Software\VB and VBA Program...
9
1259
by: Just Me | last post by:
Public Shared Function GetValue(ByVal keyName As String, ByVal valueName As String, Optional ByVal badKey As Object = "") As Object Dim UserKey As RegistryKey =...
3
1785
by: Aussie Rules | last post by:
Hi, I want to store some data in the registry, however I have not been able to do this, and think my logic maybe flawed. Firstly I try to open the registry and read in any existing values....
6
1626
by: vovan | last post by:
I'm asking for help one more time. Below are 2 procedures. The first one is used in VB 2005 Windows Form project. It works fine on XP, Vista. Private Sub RegistryReadingTest() Try Dim f As New...
2
2972
by: desertavataraz | last post by:
I am trying to save the background color of my main textbox so that if a user changes it, those changes will be automatically save and retreived when the user re-opens the application. The code...
5
5072
Sl1ver
by: Sl1ver | last post by:
I have this piece of code public bool Write(string KeyName, object Value) { try { // Setting string subKey1 =...
0
7064
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7261
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,...
0
7315
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5559
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4991
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4665
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1492
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
369
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.