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

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

'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()

'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
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
'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)
Catch ex As Exception
'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
'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
Catch ex As Exception
'no file found. Just run with the existing settings
End Try
End Sub

End Class

I'd be greatful for any suggestions.

Thank in advance
Nov 21 '05 #1
0 1275

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

Similar topics

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)
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)...
by: gani | last post by:
hi, how to get the fullpath of created IsolatedStorage directory. thanks. -- gani
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).
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
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.
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
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...
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 ?
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...
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...
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...
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();...
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...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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.