473,796 Members | 2,541 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SaveSetting/GetSetting Replacement

As an old vb6 programmer coming to C# I was wanting to update my technique
for storing app settings like for form controls state(radioButt on, checkBox
selection) and user configurable settings. In vb6 I did this by using the
SaveSetting/GetSetting pairs to store & retrieve the key value pairs
into/from the registry.

What's a better or another way to do this with C#?

Thanks
Mike

May 24 '06 #1
2 13078
C# doesn't have "built-in" functions the way VB does, so there isn't
really an equivalent.

If you want to read and write to the Registry, you use the
Microosft.Win32 .RegistryKey class.

Or, if you really like the VB functions, you can reference
Microsoft.Visua lBasic.dll and call them.

In addition there is an article on this very subject:

http://msdn.microsoft.com/library/de...albasicnet.asp

--
-Demetri
"Mike in Santa Rosa" wrote:
As an old vb6 programmer coming to C# I was wanting to update my technique
for storing app settings like for form controls state(radioButt on, checkBox
selection) and user configurable settings. In vb6 I did this by using the
SaveSetting/GetSetting pairs to store & retrieve the key value pairs
into/from the registry.

What's a better or another way to do this with C#?

Thanks
Mike

May 24 '06 #2
What about writing to an xml file like the old .ini files?

I don't necessarily need to put this into the registry.

mike
"Demetri" <De*****@discus sions.microsoft .com> wrote in message
news:33******** *************** ***********@mic rosoft.com...
C# doesn't have "built-in" functions the way VB does, so there isn't
really an equivalent.

If you want to read and write to the Registry, you use the
Microosft.Win32 .RegistryKey class.

Or, if you really like the VB functions, you can reference
Microsoft.Visua lBasic.dll and call them.

In addition there is an article on this very subject:

http://msdn.microsoft.com/library/de...albasicnet.asp

--
-Demetri
"Mike in Santa Rosa" wrote:
As an old vb6 programmer coming to C# I was wanting to update my
technique
for storing app settings like for form controls state(radioButt on,
checkBox
selection) and user configurable settings. In vb6 I did this by using the
SaveSetting/GetSetting pairs to store & retrieve the key value pairs
into/from the registry.

What's a better or another way to do this with C#?

Thanks
Mike

May 24 '06 #3

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

Similar topics

5
2518
by: Paul Miller | last post by:
We've run into minidom's inabilty to handle large (20+MB) XML files, and need a replacement that can handle it. Unfortunately, we're pretty dependent on a DOM, so a pulldom or SAX replacement is likely out of the question for now. Has someone done a more efficient minidom replacement module that we can just drop in? Preferrably written in C?
53
4969
by: Kerberos | last post by:
I followed Dan Cederholm's image replacement tutorial, to replace a header tag by a logo. The h1 is clickable if no CSS is applied but it I replace it by the logo, the area isn't clickable anymore when I pass the mouse over the logo. Is there a way to replace a link by an image that will still be clickable? Thanks, -- Kerberos.
3
9747
by: Vibha Tripathi | last post by:
Hi Folks, I put a Regular Expression question on this list a couple days ago. I would like to rephrase my question as below: In the Python re.sub(regex, replacement, subject) method/function, I need the second argument 'replacement' to be another regular expression ( not a string) . So when I find a 'certain kind of string' in
1
1436
by: Roundy | last post by:
We have an application that communicates with a PLC in the field. All of the values from the PLC are written to registry keys under hkey_current_user\software\vb and vba programming\application name\subkey\value. We were trying to access the registry key directly using asp. I found a tool to access registry, but for some reason it can't read or write values to hkey_current_user. So, we wrote and active x dll that using gettsetting and...
20
5701
by: Paul D. Boyle | last post by:
Hi all, There was a recent thread in this group which talked about the shortcomings of fgets(). I decided to try my hand at writing a replacement for fgets() using fgetc() and realloc() to read a line of arbitrary length. I know that the better programmers in this group could write a more robust function, but here is my shot at it anyway. I would appreciate people's comments on my fget_line() code below (usage example included). Any...
2
3409
by: Mike | last post by:
VB .NET version 2003 What is the equivalent of GetSetting when trying to read a .INI file. I'm trying to read a .INI file and can't find anything that will help.
0
1686
by: Brad Dennis | last post by:
Using Access 2003, I have a form that reads registry settings using the GetSetting function. It works fine as long as I haven't signed the VBA code. But after using my Thawte Code Signing Certificate, my database usually fails when opening the signed file. I get a message complaining about "BeginBatchEdit" and the registry does not get read.
1
2332
by: lawrence k | last post by:
Want to replace the limit clause in a query, but can't get it right. What's wrong with this: $pattern = "(.*)limit (.*)"; $replacement = '$1'; $replacement .= "LIMIT $limit"; $replacement .= '$2'; $query = preg_replace ($pattern, $replacement, $query);
3
2289
by: =?Utf-8?B?RHVrZSAoQU4yNDcp?= | last post by:
I've added a web deployment project and want to use the config section replacement but I'm obviously not understanding something. I have set up an alternate appSettings file, test.appSettings.config, and when I build the appSettings are correctly overridden, but I also end up with a copy of test.appSettings.config in my web site. If I have config sections for several environments they all get copied. How do I stop the copy? I wondered...
0
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9531
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10459
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10237
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10187
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7553
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6795
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5446
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4120
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 we have to send another system

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.