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

C# will not write the entire string to the registry

I have a program that encrypts a datetime objects "to
long datetime string" string to and encrypted sequence.
The problem is this: if I use the following source code
it works (key is declared earlier and works fine):

string valueName= "Date Installed";
key.SetValue(valueName, "²ã95ì.*úÞx e¸<¡uO2s¯EÔ");

The problem is this code doesn't:

string valueName = "Date Installed";
object s1 = "²ã95ì.*úÞx e¸<¡uO2s¯EÔ";
//(I have tried string instead of object)

key.SetValue(valueName, Convert.ToString(s1));

When I check the registry in this case, only "²ã95ì.*úÞx"
was written. Please help if you can! This is driving me
crazy!
Nov 15 '05 #1
1 1329
"Dean Bortell" <bo******@cdfainc.com> wrote in news:028f01c3abca$c0584660
$a*******@phx.gbl:
I have a program that encrypts a datetime objects "to
long datetime string" string to and encrypted sequence.
The problem is this: if I use the following source code
it works (key is declared earlier and works fine):

string valueName= "Date Installed";
key.SetValue(valueName, "²ã95ì.*úÞx e¸<¡uO2s¯EÔ");

The problem is this code doesn't:

string valueName = "Date Installed";
object s1 = "²ã95ì.*úÞx e¸<¡uO2s¯EÔ";
//(I have tried string instead of object)

key.SetValue(valueName, Convert.ToString(s1));

When I check the registry in this case, only "²ã95ì.*úÞx"
was written. Please help if you can! This is driving me
crazy!


You shouldn't write encoded strings as a string into the registry. Better
write them as a byte array so that you won't have any problems with
special encodings.

To get the Bytes from the string use System.Text Namespace and the
Encoding classes.

greets
Peter

--
------ooo---OOO---ooo------

Peter Koen - www.kema.at
MCAD CAI/RS CASE/RS IAT

------ooo---OOO---ooo------
Nov 15 '05 #2

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

Similar topics

0
by: Mark | last post by:
I need to search through the Windows registry for specific string values that I need to change. I have been struggling with tie::registry, but I can't get my code to work. Can someone provide a...
1
by: Dean Bortell | last post by:
I have a program that encrypts a datetime objects "to long datetime string" string to and encrypted sequence. The problem is this: if I use the following source code it works (key is declared...
1
by: Daniel | last post by:
Is there any way for System.IO.StreamWriter Write method to write out part of the string to file. such as if the machine is shut down half way through? or does the file not actually exist until the...
3
by: caldera | last post by:
Hi, I write a windows service. In that service I create a new subkey for registry. But service install is call CreateSubKey() the program throw an exception to the event log said that Cannot write...
5
by: Lyle Fairfield | last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/callnetfrcom.asp The Joy of Interoperability Sometimes a revolution in programming forces you to abandon all...
9
by: nbs.tag | last post by:
hey guys heres my question. I was told by a little birdie that .net 2.0 has the ability to read a connection string directly from a registry key. so in the registry key a string value of say :...
9
by: PengYu.UT | last post by:
Hi, I feel argparse has some useful things that optparse doesn't have. But I can't find it argparse in python library reference. I'm wondering when it will be available in the python standard...
20
by: Newbie Coder | last post by:
MFC Application VC++.NET 2003 I have a certain registry key (HKCU\Software\MyKey) that contains between 30 & 64 string values I need to write a '*' to all those 30 - 64 string values under...
8
by: Kniffel | last post by:
hi everyone I programm an ISAPI extension with embedded Visual C++ for a Windows CE device. I try to write the network settings to the registry. I am able to write the IpAdress to the registry,...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.