Home
Explore
Tags
Contribute
Home
»
VB.NET
»
VISUAL BASIC LANGUAGE
IsolatedStorageFile Class using VB.NET
Posted in
VB.NET
|
VISUAL BASIC LANGUAGE
on
November 07, 2019
Tags:
VB.NET
,
IsolatedStorageFile
,
IsolatedStorageFile Class
,
IsolatedStorageFile Class in VB.NET
In this article I will explain you about IsolatedStorageFile Class in VB.NET.
1912
The VB.NET provides the IsolatedStorageFile class to represent a store for an assembly.
Listing 22.34 shows various aspects of IsolatedStorage namespace classes and methods.
Listing 22.34: IsolatedStorage Example
Imports
System.Collections.Generic
Imports
System.Linq
Imports
System.Text
Imports
System.IO.IsolatedStorage
Imports
System.IO
Namespace
IsolatedStorageFile_Class
Class
Program
Private
Shared
Sub
Main(
ByVal
args
As
String
())
' isolated storage
' in System.IO.IsolatedStorage namespace
' Obtain a store
Dim
store1
As
IsolatedStorageFile
=
IsolatedStorageFile
.GetUserStoreForDomain()
' you can also use static GetStore methods like below
'
' IsolatedStorageFile storefile1 = IsolatedStorageFile.GetStore(
' IsolatedStorageScope.User |
' IsolatedStorageScope.Assembly,
' null,
' null);
' IsolatedStorageFile storefile1 = IsolatedStorageFile.GetStore(
' IsolatedStorageScope.User |
' IsolatedStorageScope.Assembly |
' IsolatedStorageScope.Domain,
' null,
' null);
' IsolatedStorageFile storefile1 = IsolatedStorageFile.GetStore(
' IsolatedStorageScope.User |
' IsolatedStorageScope.Assembly |
' IsolatedStorageScope.Roaming,
' null,
' null);
' IsolatedStorageFile storefile1 = IsolatedStorageFile.GetStore(
' IsolatedStorageScope.User |
' * IsolatedStorageScope.Assembly |
' IsolatedStorageScope.Domain |
' IsolatedStorageScope.Roaming,
' null,
' null);
'
Dim
stream1
As
New
IsolatedStorageFileStream
(
"file1.txt"
,
FileMode
.Create, store1)
Dim
writer
As
New
StreamWriter
(stream1)
writer.WriteLine(
"Hello Isolated Storage"
)
writer.Close()
stream1.Close()
store1.Close()
' Read from a file in isolated storage
Dim
stream2
As
New
IsolatedStorageFileStream
(
"file2.txt"
,
FileMode
.Open, store1)
Dim
reader
As
New
StreamReader
(stream1)
Dim
sb
As
[String]
= reader.ReadToEnd()
reader.Close()
stream1.Close()
store1.Close()
' Obtain a store
' Create a directory
store1.CreateDirectory(
"dir1"
)
' Create two directories, one inside the other
store1.CreateDirectory(
"dir2/dir3"
)
' Create a directory
store1.CreateDirectory(
"dir4"
)
' Delete the directory
store1.DeleteDirectory(
"dir4"
)
' Obtain a store
Dim
store2
As
IsolatedStorageFile
=
IsolatedStorageFile
.GetUserStoreForDomain()
' Create an empty file
Dim
stream3
As
New
IsolatedStorageFileStream
(
"file3.txt"
,
FileMode
.Create, store1)
stream1.Close()
' Delete the file
store1.DeleteFile(
"file3.txt"
)
' Find a storage space available
' Obtain a store
Dim
store3
As
IsolatedStorageFile
=
IsolatedStorageFile
.GetUserStoreForDomain()
' Compute the storage available in the store
Dim
spaceLeft
As
ULong
= store1.MaximumSize - store1.CurrentSize
' Enumerate files and directories
' Obtain a store
Dim
store4
As
IsolatedStorageFile
=
IsolatedStorageFile
.GetUserStoreForDomain()
' Get all of the directories in the root of the store
Dim
directories
As
String
() = store1.GetDirectoryNames(
"*"
)
' Get all of the files in the root of the store
Dim
files
As
String
() = store1.GetFileNames(
"*"
)
End
Sub
End
Class
End
Namespace
Conclusion
Hope this article would have helped you in understanding IsolatedStorageFile Class in VB.NET.
Related Articles
VB.NET IsolatedStorageFile Class
Conversion Classes & CultureInfo Class in VB.NET
BinaryReader and BinaryWriter Classes in VB.NET
Creating Your Own Exception Classes in VB.NET
TraceListener Classes in VB.NET
TextReader and TextWriter Classes in VB.NET
FileInfo class in VB.NET
WPF Grid Using VB.NET
Timer in WPF using VB.NET
String and Math Functions in Visual Basic .NET
Categories
ACTIVE DIRECTOTRY IN VB.NET
ALGORITHMS AND VB.NET
ARRAY IN VB.NET
ASP.NET AJAX IN VB.NET
ASP.NET USING VB.NET
ASSEMBLIES IN VB.NET
COM INTEROP IN VB.NET
CRYPTOGRAPHY IN VB.NET
CRYSTAL REPORTS IN VB.NET
DATABASE & DBA
DEPLOYMENT IN VB.NET
DESIGN & ARCHITECTURE
DIRECTX WITH VB.NET
ENTERPRISE DEVELOPMENT
FILE IN VB.NET
GAMES IN VB.NET
GDI+ IN VB.NET
GENERAL
LINQ WITH VB.NET
MOBILE DEV IN VB.NET
MULTITHREADING IN VB.NET
NETWORKIN WITH VB.NET
OFFICE AND VB.NET
PRINTING IN VB.NET
REMOTING IN VB.NET
REPORTS IN VB.NET
SECURITY IN VB.NET
SILVERLIGHT USING VB.NET
Speech in VB.NET
STRING IN VB.NET
TABLET PC
VB.NET ADO.NET
VB.NET ARTICLE
VB.NET EXCEPTION HANDLING
VB.NET FAQ
VB.NET HOW DO I
VB.NET LANGUAGE
VB.NET TUTORIALS
VB.NET WINDOWS SERVICES
VBA
VISUAL BASIC 10
VISUAL BASIC LANGUAGE
WCF WITH VB.NET
WEB CONTROL IN VB.NET
WEB DEV IN VB.NET
WEB FORM WITH VB.NET
WEB SERVICES IN VB.NET
WINDOWS CONTROLS
WINDOWS FORMS IN VB.NET
WORKFLOW IN VB.NET
WPF IN VB.NET
XAML IN VB.NET
XML IN VB.NET
More Articles
Algorithm Generate Fibonacci Series in VB.NET
Algorithm - Factorial of an Number in VB.NET
Algorithm Quadrant in VB.NET
Algorithm Circular Queue in VB.NET
Algorithm Queues in VB.NET
Algorithm Stack in VB.NET
Algorithm Concept in VB.NET
How to use .NET Assemblies in VB.NET
How to create assembly in VB.NET
VB.NET Create Instance of a Type Dynamically
Select and Delete Ink in Tablet PC in VB.NET
Using Tablet PC Ink on Windows Controls in VB.NET
Tablet PC Frequently Asked Question in VB.NET
Setting Ink Overlay Properties in Tablet PC in VB.NET
VB.NET Advanced Controls of Mobile Internet
MediaElement control in Windows Phone 7
Image Brush Background set in Windows Phone 7
Mobile Mail sending Application in ASP.NET using VB.NET
Mobile Banking Application in ASP.NET using VB
I-MODE Client and Mobile Programming in VB.NET
Basic User Interface Controls of Mobile Internet in VB.NET
Basics of the Mobile Internet Toolkit using VB.NET
A glance at .NET Framework 3.0 in VB.NET
Reflection in VB.NET
Custom Exception Handling in VB.NET
Exception Handling in VB.NET
Inheritance in VB.NET
Retrieving Environment Variables in VB.NET
Introduction of Visual Studio 2008 in VB.NET: Part 1
VB.NET Select statement in SQL query
Dialog Box in VB.NET
Windows Registry in VB.NET
Get Current Time Zone in VB.NET
VB.NET Balloon Tooltip
Binding a ComboBox in VB.NET
Image as Button Background in VB.NET
Button State in VB.NET
Operating System Version in VB.NET
How many users are using the site at a same time?
BorderThickness Value in WPF
VB.NET display data in the FormView control
Add Web Server Controls to a PlaceHolder control at run time
DropDownList control through data binding in VB.NET
DropDownList control that contains items in VB.NET
How do I open a URL in a new Browser Window in ASP.NET?
Display an XmlNode contents in a DataGrid?
Delete a directory in VB.NET
Create and Save Bitmap Image in VB.NET?
VB.NET Constants
Variables in VB.NET
© 2020 DotNetHeaven. All rights reserved.
TERMS & CONDITIONS
|
CONTACT US
|
REPORT ABUSE