473,847 Members | 1,508 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using isolated storage to save boolean values in .net

I am trying to save some boolean values from checkboxes using isolated
storage. I am able to do strings and integers without a problem but I
can't work out how to save boolean values without seeing the error
message below:

'Additional information: Argument 'Prompt' cannot be converted to type
'String'

The error message is displayed at this line of code in the form load
event.

'Dim isfs1 As IsolatedStorage FileStream = New
IsolatedStorage FileStream("frm GSCCServerConfi g.xml", FileMode.Open,
FileAccess.Read , isf)'
The full code listing is below:

Public Class frmGSCCServerCo nfigurationClas s
Public EnableJobsInteg ration, ForceFixes As Boolean
End Class
Imports System.IO
Imports System.IO.Isola tedStorage
Imports System.Xml
Imports System.Xml.Seri alization

Public Class frmGSCCServerCo nfig
Inherits System.Windows. Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeCompo nent()

'Add any initialization after the InitializeCompo nent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub
Private Sub btnSave_Click(B yVal sender As System.Object, ByVal e
As System.EventArg s) Handles btnSave.Click
Try
'get the isolated store for this assembly
Dim isf As IsolatedStorage File =
IsolatedStorage File.GetUserSto reForAssembly()

'create or truncate the settings file
'this will ensure that only the object we're
'saving right now will be in the file

Dim isfs1 As IsolatedStorage FileStream = New
IsolatedStorage FileStream("frm GSCCServerConfi g.xml", FileMode.Create ,
FileAccess.Writ e, isf)

'Construct an object and tell it about the form
Dim fs As frmGSCCServerCo nfigurationClas s = New
frmGSCCServerCo nfigurationClas s
fs.EnableJobsIn tegration =
Me.chkEnableJob sIntegration.Ch ecked
fs.ForceFixes = Me.chkForceFixe s.Checked

'serialize the object to the file
Dim xs As XmlSerializer = New
XmlSerializer(G etType(frmGSCCS erverConfigurat ionClass))
xs.Serialize(is fs1, fs)
isfs1.Close()
Catch ex As Exception
MsgBox(ex)
'if setting can't be saved,next run will just use the
'form defaults
End Try
End Sub

Private Sub frmGSCCServerCo nfig_Load(ByVal sender As Object, ByVal
e As System.EventArg s) Handles MyBase.Load
Try
'get the isolated store for this assembly
Dim isf As IsolatedStorage File =
IsolatedStorage File.GetUserSto reForAssembly()

'Open the settings file
Dim isfs1 As IsolatedStorage FileStream = New
IsolatedStorage FileStream("frm GSCCServerConfi g.xml", FileMode.Open,
FileAccess.Read , isf)

'Deserialize the XML to an object
Dim fs As frmGSCCServerCo nfigurationClas s = New
frmGSCCServerCo nfigurationClas s
Dim xtr As XmlTextReader = New XmlTextReader(i sfs1)
Dim xs As XmlSerializer = New
XmlSerializer(G etType(frmGSCCS erverConfigurat ionClass))
fs = CType(xs.Deseri alize(xtr),
frmGSCCServerCo nfigurationClas s)

'And apply the settings to the form
chkEnableJobsIn tegration.Check ed =
fs.EnableJobsIn tegration.Equal s(Boolean.TrueS tring)
chkForceFixes.C hecked =
fs.ForceFixes.E quals(Boolean.T rueString)

'Clean up
isfs1.Close()
Catch ex As Exception
'no file found. Just run with the existing settings
MsgBox(ex)
End Try
End Sub

End Class


I'd be greatful for any suggestions.

Thank in advance
Robert
Nov 21 '05 #1
0 1275

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

Similar topics

1
2470
by: Jody Gelowitz | last post by:
Exactly what is the size limit of Isolated Storage in the Internet permission set? I have a document indicating it is 10MB (http://msdn.microsoft.com/msdnmag/issues/02/07/NetSmartClients/) There is another document indicating it is 10240 in size (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/ht ml/cpcondefaultsecuritypolicy.asp)
3
24041
by: Random Person | last post by:
Does anyone know how to use VBA to relink tables between two MS Access databases? We have two databases, one with VBA code and the other with data tables. The tables are referenced by linked tables in the database where the code resides. If we move the database with the data tables to a new directory, the links are no longer valid. I tried to update the links by changing the Connect property and refreshing: Set td = db.TableDefs(0)...
3
2281
by: gani | last post by:
hi, how to get the fullpath of created IsolatedStorage directory. thanks. -- gani
1
1910
by: malcolm | last post by:
Hello, We use several user controls and derived custom controls. Some of which actually hit the database at design time to show data (such as filling a list box, etc...) Our c# client server app uses the .NET Isolated storage libraries for storing connection string and other info about the application. The problem is that the Isolated storage bombs at design time (when you try and view a control that hits the database at design time).
0
1884
by: Namratha Shah \(Nasha\) | last post by:
Hey Group, After a long week end I am back again. Its nice and refreshing after a short vacation so lets get started with .NET once again. Today we will discuss about Isolated Storage. This is one of the topics which I find interesting as I feel that it has a lot of practical usage or applicability. We all know that all applications need some storage space to archive certain
12
3825
by: shawnn | last post by:
Hello, By default, when you create an App.config file it gets named as MyApp.exe.config after build. I don't like this name and would rather have the file named MyApp.config, the .exe.config thing might confuse my users. Is there any way to do this, or am I stuck with MyApp.exe.config?? Thanks.
2
4571
by: Bob | last post by:
Using VS2005 andf VB.NET how can you store a faile in protected storage. How can you retrieve and open a file from protected storage? Can anyone point me to snippets of code doing this? Thanks for any help Bob
1
3219
by: C#Coder | last post by:
I need to create an Isolated Storage File for my assembly with machine level scope. I have used the 'GetMachineStoreForAssembly' method to do this and this creates the Isolated Storage File successfully but when I log onto another profile and run the code, it creates another Isolated Storage File (in C:\Documents and Settings\All Users\Application Data\IsolatedStorage\) rather than writing/reading to/from the existing file. It would seem...
2
2780
by: Andrus | last post by:
WinForms MDI application stores user preferences (form position, sizes, query params etc) in isolated storage. I want to offer user menu selection "Restore defaults" which deletes all those items so default settings are applied. Best way for this is probably to delete all files in isolated storage. How to clear all files in current isolated storage ?
0
10995
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
10656
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
10347
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
7061
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
5730
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...
0
5915
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4541
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
2
4132
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3171
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.