473,382 Members | 1,441 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,382 software developers and data experts.

Retrieving data from register

Hello,

When I want to retrieve data from the register, the defaultvalue doesn't
seem to work correctly.

iCounter =
CInt(My.Computer.Registry.Getvalue("HKEY_LOCAL_MAC HINE\Software\MyProg\Settings",
"Articles", "80"))

Is it correct that when the entry in the register does not exist, the string
"80" is taken as default?
This does not seem to work with me.
When the key Articles doesn't exist, there is no error and iCounter is set
to 80.
When the key Settings doesn't exist, there is sometimes an error and
sometimes iCounter is set to 0.

Does anyone have any idea what goes wrong?

Many thanks,

Michel
May 15 '07 #1
1 1095
Hi Michel,

It's entirely possible you can determine what is going on by breaking down
your code into more readable chunks. Does the key "Settings" exist? What
about "MyProg"? Either way, its easier to see what is going on with
something like:

Dim theValue As String =
My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\ Software\MyProg\Settings",
"Articles", "80").ToString()

If theValue Is Nothing Then

' The key or part of the path does not exist

Throw New Exception ( .... )

End If

Dim theResult As Integer

If Not Integer.TryParse(theValue, theResult) Then

' A value was returned but it wasn't an integer...

Throw New Exception ( .... )

End If


Robin

Dim theSetting As
"Michel Vanderbeke" <mi***************@skynet.bewrote in message
news:uC**************@TK2MSFTNGP04.phx.gbl...
Hello,

When I want to retrieve data from the register, the defaultvalue doesn't
seem to work correctly.

iCounter =
CInt(My.Computer.Registry.Getvalue("HKEY_LOCAL_MAC HINE\Software\MyProg\Settings",
"Articles", "80"))

Is it correct that when the entry in the register does not exist, the
string "80" is taken as default?
This does not seem to work with me.
When the key Articles doesn't exist, there is no error and iCounter is set
to 80.
When the key Settings doesn't exist, there is sometimes an error and
sometimes iCounter is set to 0.

Does anyone have any idea what goes wrong?

Many thanks,

Michel


May 15 '07 #2

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

Similar topics

0
by: kid4rilla | last post by:
I can successfully write the binary data to an image data type, and successfully retrieve it, but when I attempt to play the file in media player after retrieving it, I get the file type isn't...
0
by: fernandezr | last post by:
Hi, I've got a user control that is referenced twice on the same page and I'd like to access the textbox values on postback so I can update a database. How can get the values for each instance of...
0
by: Andy | last post by:
Hi All. I'm working for a company that has set out a guideline for retrieving data from a database. Nobody can explain to me the reason for the following. When retrieving a set of records...
1
by: jimmyfo | last post by:
Hi, I recently wrote an ASP.Net web application in VS2005 and published (using VS2005 Publish feature) it to a relatively clean machine with ASP.Net 2.0 and MDAC 2.8 installed on it. However, when...
10
by: Girish | last post by:
Hi Everyone, I am passing a form to a php script for further processing. I am able to retrieve the last value set for that given form variable using $variable=$_REQUEST;
1
Frinavale
by: Frinavale | last post by:
Hi there :) I've finally moved my Online Registration project on to the box where it will be hosted. This new server is running IIS6. After moving the project to the new server and running...
5
by: Sanjay Pais | last post by:
I have a table with over 1.3 million rows. I am retrieving only 20 at a time using the with - over clauses In query analyser, the data is retrieved in under a second. When retrieving using the...
4
by: srblinux | last post by:
Hi all, Where we use Register data type varible in Device drivers? Before the .obj or .exe Generation where we use register data type Declaration.
9
by: gavy7210 | last post by:
hello friends i am new to struts. i want to add the user information in the database and then display it back to him. i am using struts 1.2,Eclipse Platform Version: 3.4.2,mySql 5.0.1,jdk...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.