473,788 Members | 2,759 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can we use Configuration, ConfigurationMa nager in Vb.net 2003

115 New Member
i'm using VB.NET 2003.

Last time while i did a program in Vb.Net 2005, i use "Configuration" . and i could read and write to that XML configuration file like the example below.


CODES:
Imports System.Configur ation

Private Sub btnSave_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles btnSave.Click

Dim config As Configuration

config = ConfigurationMa nager.OpenExeCo nfiguration(App lication.Startu pPath + "\Program1.exe" )
config.AppSetti ngs.Settings.Re move("inactivit y")
config.AppSetti ngs.Settings.Ad d("inactivity ", udInactivity.Va lue.ToString())

If (axChkterminals .Checked = True) Then
config.AppSetti ngs.Settings.Re move("chkallter minals")
config.AppSetti ngs.Settings.Ad d("chkalltermin als", str)
Else
config.AppSetti ngs.Settings.Re move("chkallter minals")
config.AppSetti ngs.Settings.Ad d("chkalltermin als", str)
End If

If (axChkMonday.Ch ecked = True) Then
str = "monday" + "," + udHoursMonday.V alue.ToString() + "," + udMinsMonday.Va lue.ToString() + "," + udHoursToMonday .Value.ToString () + "," + udMinsToMonday. Value.ToString( )
config.AppSetti ngs.Settings.Re move("monday")
config.AppSetti ngs.Settings.Ad d("monday", str)
Else
config.AppSetti ngs.Settings.Re move("monday")
End If

If (MessageBox.Sho w("Are you sure you want to save?", "Calendar", MessageBoxButto ns.YesNo, MessageBoxIcon. Question) = Windows.Forms.D ialogResult.Yes ) Then
config.Save()
MessageBox.Show ("Configurat ion File has been saved!")
End If

End Sub


Public Function LoadConfigValue s() As String
Dim config As Configuration

config = ConfigurationMa nager.OpenExeCo nfiguration(App lication.Startu pPath + "\Program1.exe" )

inactivityTime = Convert.ToDecim al(config.AppSe ttings.Settings ("inactivity"). Value)

CheckAllTermina ls = Convert.ToDecim al(config.AppSe ttings.Settings ("chkalltermina ls").Value)

day = config.AppSetti ngs.Settings("m onday").Value.T oString().ToLow er()
If (day.Split(spli tter)(0).ToLowe r() = "monday") Then
config_DaysList .Remove("monday ")
config_DaysList .Add("monday", day)
End If

End Function


And the same type of program i need to do now in Vb.net 2003. but i can use Configuration inside 2003. when i tried to add reference instead of "System.Configu ration" its "System.configu ration.install" . and i add that and tried the same codes above to my Vb.net 2003 program.

but in this lines error occurs as Type expected.
Code:
Dim config As Configuration

and in this lines error occurs as Name 'ConfigurationM anager' is not declared.
Code:
config = ConfigurationMa nager.OpenExeCo nfiguration(App lication.Startu pPath + "\Program1.exe" )

whether i can use "Configurat ion" in 2003.if you have anyidea what's wrong please let me know. if you can please help me.

Thanks in advance.
Sep 27 '07 #1
2 2790
nateraaaa
663 Recognized Expert Contributor
i'm using VB.NET 2003.

Last time while i did a program in Vb.Net 2005, i use "Configuration" . and i could read and write to that XML configuration file like the example below.


CODES:
Imports System.Configur ation

Private Sub btnSave_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles btnSave.Click

Dim config As Configuration

config = ConfigurationMa nager.OpenExeCo nfiguration(App lication.Startu pPath + "\Program1.exe" )
config.AppSetti ngs.Settings.Re move("inactivit y")
config.AppSetti ngs.Settings.Ad d("inactivity ", udInactivity.Va lue.ToString())

If (axChkterminals .Checked = True) Then
config.AppSetti ngs.Settings.Re move("chkallter minals")
config.AppSetti ngs.Settings.Ad d("chkalltermin als", str)
Else
config.AppSetti ngs.Settings.Re move("chkallter minals")
config.AppSetti ngs.Settings.Ad d("chkalltermin als", str)
End If

If (axChkMonday.Ch ecked = True) Then
str = "monday" + "," + udHoursMonday.V alue.ToString() + "," + udMinsMonday.Va lue.ToString() + "," + udHoursToMonday .Value.ToString () + "," + udMinsToMonday. Value.ToString( )
config.AppSetti ngs.Settings.Re move("monday")
config.AppSetti ngs.Settings.Ad d("monday", str)
Else
config.AppSetti ngs.Settings.Re move("monday")
End If

If (MessageBox.Sho w("Are you sure you want to save?", "Calendar", MessageBoxButto ns.YesNo, MessageBoxIcon. Question) = Windows.Forms.D ialogResult.Yes ) Then
config.Save()
MessageBox.Show ("Configurat ion File has been saved!")
End If

End Sub


Public Function LoadConfigValue s() As String
Dim config As Configuration

config = ConfigurationMa nager.OpenExeCo nfiguration(App lication.Startu pPath + "\Program1.exe" )

inactivityTime = Convert.ToDecim al(config.AppSe ttings.Settings ("inactivity"). Value)

CheckAllTermina ls = Convert.ToDecim al(config.AppSe ttings.Settings ("chkalltermina ls").Value)

day = config.AppSetti ngs.Settings("m onday").Value.T oString().ToLow er()
If (day.Split(spli tter)(0).ToLowe r() = "monday") Then
config_DaysList .Remove("monday ")
config_DaysList .Add("monday", day)
End If

End Function


And the same type of program i need to do now in Vb.net 2003. but i can use Configuration inside 2003. when i tried to add reference instead of "System.Configu ration" its "System.configu ration.install" . and i add that and tried the same codes above to my Vb.net 2003 program.

but in this lines error occurs as Type expected.
Code:
Dim config As Configuration

and in this lines error occurs as Name 'ConfigurationM anager' is not declared.
Code:
config = ConfigurationMa nager.OpenExeCo nfiguration(App lication.Startu pPath + "\Program1.exe" )

whether i can use "Configurat ion" in 2003.if you have anyidea what's wrong please let me know. if you can please help me.

Thanks in advance.
Try using ConfigurationSe ttings instead of ConfigurationMa nager. ConfigurationMa nager replaced ConfigurationSe ttings when they released VS 2005.

Nathan
Sep 27 '07 #2
remya1000
115 New Member
thanks a lot for your reply and help...

but as i said in my earlier post, i can't even use Configuration. when i give dim gConfig as configuration , then error is there - type excepeted. so how can i use configurationse ttings without declaring configuration.

i'm new to programming. so if you can please give me some more information. and if you can provide some examples, then it will be a great help for me.

thanks in advance.
Sep 28 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
4869
by: Jason | last post by:
Hi, I'm trying to integrate Microsoft's Configuration Management Application Block (CMAB), and have run into a bit of trouble. Would appreciate any input anybody could provide at this point. I simply keep running into exceptions when trying to integrate the block into my app. Here's what I've done thus far: 1. Installed the CMAB 2. Started a new C# project.
0
1212
by: Jorgas | last post by:
Hi! I try to use the configuration application block from the Enterprise Library and have done prework as specified from one of the hands-on labs from that package. When trying to get configuration settings using the ConfigurationManager.GetConfiguration my application, which is a windows service, stops with the following error message (parts of it) written to the event log. "Service cannot be started. System.IO.FileNotFoundException:...
8
10222
by: Alberto | last post by:
Can you tell me how to read and modify a value in the app.config file using this class? Thank you very much
3
5815
by: Jyothi Kumar | last post by:
Hi, my project is a migrated project from VS 2003 to VS 2005, in this project I used System.Configuration.ConfigurationSettings.AppSettings, now in VS 2005 it is giving a warning Message like: ConfigurationSettings.AppSettings is Obsolete, please replace with ConfigurationManager.AppSettings, but Iam unable to find this ConfigurationManager class in System.Configuration namespace, but if I add System.Configuration.dll as reference to my project...
7
10828
by: =?Utf-8?B?RG91Z2llIEJyb3du?= | last post by:
Hi I've written custom configuration section (inherits from System.Configuration.ConfigurationSection) to simplify the contents of the config file and to make life easier when accessing them in code. The configuration section is contained within the exe (it's a simple test case!) and everything works well debugging within the IDE or if the application is deployed on a drive or share that has been granted full trust. For the share the...
1
1804
by: =?Utf-8?B?Vmlua2k=?= | last post by:
I keep getting this warining in my code, but when i tried to look at the intellisense after system.configuration. , I couldn't find configurationManager but when i forced to put configurationManager, it gave me an errror that configurationManager does not exists. I am using .net 2.0 Warning 1 'System.Configuration.ConfigurationSettings.AppSettings' is obsolete: 'This method is obsolete, it has been replaced by...
0
1985
by: =?Utf-8?B?U3VzYW4=?= | last post by:
We are trying to move to a 64 bit architecture, but I'm still having some issues. I have the code with the 32 bit version of Oracle working fine on a 64 bit computer with Windows Server 2003 (also 64 bit version). .Net Framework 2.0 SDK for both 64 bit and 32 bit are installed on the machine along with the 32 bit version of Oracle Client and Oracle ODP. Here's my problem: when I compile my program as x86, then I get the following error:...
2
2736
by: pantagruel | last post by:
Hi, I have a Visual studio 2005 project that runs as a Windows Service. In it I have declared that I am using System.Configuration. I have set one application setting for the service using the settings panel. When I try to do the following;
2
3830
by: Thomas Bauer | last post by:
Hello, I have a config file. <?xml version="1.0" encoding="utf-8"?> <configuration> <appSettings> <add key="Directory" value="C:\_Database\" /> <add key="CloseApplication" value="0" /> <add key="Extension" value="*.txt,*.log" />
0
9656
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
9498
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
10373
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
10177
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...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8995
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7519
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...
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2897
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.