development with my 1 visual basic run-time - vb-net.comvb-net.com/vb2015/language/vb my.pdf ·...

26
Development with My 1 Visual Basic run-time objects 3 Visual Basic Runtime Library Members 6 Interaction 13 FileSystem 17

Upload: vuhuong

Post on 31-Jan-2018

227 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

Development with My 1

Visual Basic run-time objects 3

Visual Basic Runtime Library Members 6

Interaction 13

FileSystem 17

Page 2: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

Development with My (Visual Basic)

Visual Basic provides new features for rapid application development that improve productivity and ease of use while

delivering power. One of these features, called My, provides access to information and default object instances that are

related to the application and its run-time environment. This information is organized in a format that is discoverable

through IntelliSense and logically delineated according to use.

Top-level members of My are exposed as objects. Each object behaves similarly to a namespace or a class with Shared

members, and it exposes a set of related members.

This table shows the top-level My objects and their relationship to each other.

In This Section

Visual Studio 2012

Development with My (Visual Basic) https://msdn.microsoft.com/en-us/library/5btzf5yk(d=printer,v=vs.110).aspx

1 of 2 04.09.2016 1:18

Page 3: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

Performing Tasks with My.Application, My.Computer, and My.User (Visual Basic)

Describes the three central My objects, My.Application, My.Computer, and My.User, which provide access to

information and functionality

Default Object Instances Provided by My.Forms and My.WebServices (Visual Basic)

Describes the My.Forms and My.WebServices objects, which provide access to forms, data sources, and XML

Web services used by your application.

Rapid Application Development with My.Resources and My.Settings (Visual Basic)

Describes the My.Resources and My.Settings objects, which provide access to an application's resources and

settings.

Overview of the Visual Basic Application Model

Describes the Visual Basic Application Startup/Shutdown model.

How My Depends on Project Type (Visual Basic)

Gives details on which My features are available in different project types.

See AlsoReference

ApplicationBase

Computer

User

My.Forms Object

My.WebServices Object

Concepts

How My Depends on Project Type (Visual Basic)

© 2016 Microsoft

Development with My (Visual Basic) https://msdn.microsoft.com/en-us/library/5btzf5yk(d=printer,v=vs.110).aspx

2 of 2 04.09.2016 1:18

Page 4: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

Objects (Visual Basic)

 

This topic provides links to other topics that document the Visual Basic run-time objects and contain tables of their member

procedures, properties, and events.

Visual Basic Run-time Objects

Collection Provides a convenient way to see a related group of

items as a single object.

Err Contains information about run-time errors.

The My.Application object consists of the following

classes:

ApplicationBase provides members that are available in all

projects.

WindowsFormsApplicationBase provides members

available in Windows Forms applications.

ConsoleApplicationBase provides members available in

console applications.

Provides data that is associated only with the current

application or DLL. No system-level information can be

altered with My.Application.

Some members are available only for Windows Forms or

console applications.

My.Application.Info (Info) Provides properties for getting the information about an

application, such as the version number, description,

loaded assemblies, and so on.

My.Application.Log (Log) Provides a property and methods to write event and

exception information to the application's log listeners.

My.Computer (Computer) Provides properties for manipulating computer

components such as audio, the clock, the keyboard, the

file system, and so on.

My.Computer.Audio (Audio) Provides methods for playing sounds.

My.Computer.Clipboard (Clipboard) Provides methods for manipulating the Clipboard.

My.Computer.Clock (Clock) Provides properties for accessing the current local time

and Universal Coordinated Time (equivalent to

Greenwich Mean Time) from the system clock.

Visual Studio 2015

Objects (Visual Basic) https://msdn.microsoft.com/en-us/library/eht682b5(d=printer).aspx

1 of 3 04.09.2016 1:17

Page 5: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

My.Computer.FileSystem (FileSystem) Provides properties and methods for working with

drives, files, and directories.

My.Computer.FileSystem.SpecialDirectories

(SpecialDirectories)

Provides properties for accessing commonly referenced

directories.

My.Computer.Info (ComputerInfo) Provides properties for getting information about the

computer's memory, loaded assemblies, name, and

operating system.

My.Computer.Keyboard (Keyboard) Provides properties for accessing the current state of the

keyboard, such as what keys are currently pressed, and

provides a method to send keystrokes to the active

window.

My.Computer.Mouse (Mouse) Provides properties for getting information about the

format and configuration of the mouse that is installed

on the local computer.

My.Computer.Network (Network) Provides a property, an event, and methods for

interacting with the network to which the computer is

connected.

My.Computer.Ports (Ports) Provides a property and a method for accessing the

computer's serial ports.

My.Computer.Registry (RegistryProxy) Provides properties and methods for manipulating the

registry.

My.Forms Object Provides properties for accessing an instance of each

Windows Form declared in the current project.

My.Log (AspLog) Provides a property and methods for writing event and

exception information to the application's log listeners

for Web applications.

My.Request Object Gets the HttpRequest object for the requested page. The

My.Request object contains information about the

current HTTP request.

The My.Request object is available only for ASP.NET

applications.

My.Resources Object Provides properties and classes for accessing an

application's resources.

My.Response Object Gets the HttpResponse object that is associated with the

Page. This object allows you to send HTTP response data

to a client and contains information about that

Objects (Visual Basic) https://msdn.microsoft.com/en-us/library/eht682b5(d=printer).aspx

2 of 3 04.09.2016 1:17

Page 6: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

response.

The My.Response object is available only for ASP.NET

applications.

My.Settings Object Provides properties and methods for accessing an

application's settings.

My.User (User) Provides access to information about the current user.

My.WebServices Object Provides properties for creating and accessing a single

instance of each Web service that is referenced by the

current project.

TextFieldParser Provides methods and properties for parsing structured

text files.

See AlsoVisual Basic Language Reference

Visual Basic

© 2016 Microsoft

Objects (Visual Basic) https://msdn.microsoft.com/en-us/library/eht682b5(d=printer).aspx

3 of 3 04.09.2016 1:17

Page 7: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

Visual Basic Runtime Library Members

 

The Microsoft.VisualBasic namespace contains the classes, modules, constants, and enumerations that constitute the Visual

Basic runtime library. These library members provide procedures, properties, and constant values you can use in your code.

Each module and class represents a particular category of functionality.

Microsoft.VisualBasic.Collection Class

Add Clear Contains Count

GetEnumerator Item Remove  

Microsoft.VisualBasic.ComClassAttribute Class

ClassID EventID InterfaceID InterfaceShadows

Microsoft.VisualBasic.ControlChars Class

Back Cr CrLf FormFeed

Lf NewLine NullChar Quote

Tab VerticalTab    

Microsoft.VisualBasic.Constants Class

vbAbort vbAbortRetryIgnore vbApplicationModal vbArchive

vbArray vbBack vbBinaryCompare vbBoolean

Visual Studio 2015

Visual Basic Runtime Library Members https://msdn.microsoft.com/en-us/library/c157t28f(d=printer).aspx

1 of 7 04.09.2016 0:00

Page 8: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

vbByte vbCancel vbCr vbCritical

vbCrLf vbCurrency vbDate vbDecimal

vbDefaultButton1 vbDefaultButton2 vbDefaultButton3 vbDirectory

vbDouble vbEmpty vbExclamation vbFalse

vbFirstFourDays vbFirstFullWeek vbFirstJan1 vbFormFeed

vbFriday vbGeneralDate vbGet vbHidden

vbHide vbHiragana vbIgnore vbInformation

vbInteger vbKatakana vbLet vbLf

vbLinguisticCasing vbLong vbLongDate vbLongTime

vbLowerCase vbMaximizedFocus vbMethod vbMinimizedFocus

vbMinimizedNoFocus vbMonday vbMsgBoxHelp vbMsgBoxRight

vbMsgBoxRtlReading vbMsgBoxSetForeground vbNarrow vbNewLine

vbNo vbNormal vbNormalFocus vbNormalNoFocus

vbNull vbNullChar vbNullString vbObject

vbObjectError vbOK vbOKCancel vbOKOnly

vbProperCase vbQuestion vbReadOnly vbRetry

vbRetryCancel vbSaturday vbSet vbShortDate

vbShortTime vbSimplifiedChinese vbSingle vbString

vbSunday vbSystem vbSystemModal vbTab

vbTextCompare vbThursday vbTraditionalChinese vbTrue

vbTuesday vbUpperCase vbUseDefault vbUserDefinedType

vbUseSystem vbUseSystemDayOfWeek vbVariant vbVerticalTab

vbVolume vbWednesday vbWide vbYes

vbYesNo vbYesNoCancel    

Visual Basic Runtime Library Members https://msdn.microsoft.com/en-us/library/c157t28f(d=printer).aspx

2 of 7 04.09.2016 0:00

Page 9: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

Microsoft.VisualBasic.Conversion Module

ErrorToString Fix Hex Int

Oct Str Val  

Microsoft.VisualBasic.DateAndTime Module

DateAdd DateDiff DatePart DateSerial

DateString DateValue Day Hour

Minute Month MonthName Now

Second TimeOfDay Timer TimeSerial

TimeString TimeValue Today Weekday

WeekdayName Year    

Microsoft.VisualBasic.ErrObject Class

Clear Description Erl GetException

HelpContext HelpFile LastDllError Number

Raise Raise    

Microsoft.VisualBasic.FileSystem Module

ChDir ChDrive CurDir Dir

EOF FileAttr FileClose FileCopy

Visual Basic Runtime Library Members https://msdn.microsoft.com/en-us/library/c157t28f(d=printer).aspx

3 of 7 04.09.2016 0:00

Page 10: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

FileDateTime FileGet FileGetObject FileLen

FileOpen FilePut FilePutObject FileWidth

FreeFile GetAttr Input InputString

Kill LineInput Loc Lock

LOF MkDir Print PrintLine

Rename Reset RmDir Seek

SetAttr SPC TAB Unlock

Write WriteLine    

Microsoft.VisualBasic.Financial Module

DDB FV IPmt IRR

MIRR NPer NPV Pmt

PPmt PV Rate SLN

SYD      

Microsoft.VisualBasic.Globals Module

ScriptEngine ScriptEngineBuildVersion ScriptEngineMajorVersion ScriptEngineMinorVersion

Microsoft.VisualBasic.HideModuleNameAttribute Class

HideModuleNameAttribute      

Visual Basic Runtime Library Members https://msdn.microsoft.com/en-us/library/c157t28f(d=printer).aspx

4 of 7 04.09.2016 0:00

Page 11: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

Microsoft.VisualBasic.Information Module

Erl Err IsArray IsDate

IsDBNull IsError IsNothing IsNumeric

IsReference LBound QBColor RGB

SystemTypeName TypeName UBound VarType

VbTypeName      

Microsoft.VisualBasic.Interaction Module

AppActivate Beep CallByName Choose

Command CreateObject DeleteSetting Environ

GetAllSettings GetObject GetSetting IIf

InputBox MsgBox Partition SaveSetting

Shell Switch    

Microsoft.VisualBasic.MyGroupCollectionAttribute Class

CreateMethod DefaultInstanceAlias DisposeMethod MyGroupName

Microsoft.VisualBasic.Strings Module

Asc Asc Chr ChrW

Filter Format FormatCurrency FormatDateTime

Visual Basic Runtime Library Members https://msdn.microsoft.com/en-us/library/c157t28f(d=printer).aspx

5 of 7 04.09.2016 0:00

Page 12: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

FormatNumber FormatPercent GetChar InStr

InStrRev Join LCase Left

Len LSet LTrim Mid

Replace Right RSet RTrim

Space Split StrComp StrConv

StrDup StrReverse Trim UCase

Microsoft.VisualBasic.VBFixedArrayAttribute Class

Bounds Length    

Microsoft.VisualBasic.VBFixedStringAttribute Class

Length      

Microsoft.VisualBasic.VbMath Module

Randomize Rnd    

Microsoft.VisualBasic Constants and EnumerationsThe Microsoft.VisualBasic namespace provides constants and enumerations as part of the Visual Basic run-time library.

You can use these constant values in your code. Each enumeration represents a particular category of functionality. For

more information, see Constants and Enumerations (Visual Basic).

See AlsoConstants and Enumerations (Visual Basic)

Visual Basic Runtime Library Members https://msdn.microsoft.com/en-us/library/c157t28f(d=printer).aspx

6 of 7 04.09.2016 0:00

Page 13: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

Keywords (Visual Basic)

© 2016 Microsoft

Visual Basic Runtime Library Members https://msdn.microsoft.com/en-us/library/c157t28f(d=printer).aspx

7 of 7 04.09.2016 0:00

Page 14: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

Interaction Class

 

The Interaction module contains procedures used to interact with objects, applications, and systems.

Namespace:   Microsoft.VisualBasic

Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

Inheritance HierarchySystem.Object

  Microsoft.VisualBasic.Interaction

Syntax

Methods

Name Description

AppActivate(Int32) Activates an application that is already running.

AppActivate(String) Activates an application that is already running.

Beep() Sounds a tone through the computer's speaker.

CallByName(Object, 

String, CallType, Object())

Executes a method on an object, or sets or returns a property on an

object.

Choose(Double, Object()) Selects and returns a value from a list of arguments.

Command() Returns the argument portion of the command line used to start Visual

Basic or an executable program developed with Visual Basic. The My

feature provides greater productivity and performance than the

Command function. For more information, see CommandLineArgs.

.NET Framework (current version)

<StandardModuleAttribute>

Public NotInheritable Class Interaction

VB

Interaction Class (Microsoft.VisualBasic) https://msdn.microsoft.com/en-us/library/microsoft.visualbasic.interactio...

1 of 4 04.09.2016 1:09

Page 15: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

CreateObject(String, 

String)

Creates and returns a reference to a COM object. CreateObject cannot

be used to create instances of classes in Visual Basic unless those classes

are explicitly exposed as COM components.

DeleteSetting(String, 

String, String)

Deletes a section or key setting from an application's entry in the

Windows registry. The My feature gives you greater productivity and

performance in registry operations than the DeleteSetting function.

For more information, see Registry .

Environ(Int32) Returns the string associated with an operating-system environment

variable.

Environ(String) Returns the string associated with an operating-system environment

variable.

Equals(Object) Determines whether the specified object is equal to the current object.

(Inherited from Object.)

GetAllSettings(String, 

String)

Returns a list of key settings and their respective values (originally

created with SaveSetting) from an application's entry in the Windows

registry. Using the My feature gives you greater productivity and

performance in registry operations than GetAllSettings. For more

information, see Registry.

GetHashCode() Serves as the default hash function. (Inherited from Object.)

GetObject(String, String) Returns a reference to an object provided by a COM component.

GetSetting(String, String, 

String, String)

Returns a key setting value from an application's entry in the Windows

registry. The My feature gives you greater productivity and

performance in registry operations than GetAllSettings. For more

information, see Registry.

GetType() Gets the Type of the current instance.(Inherited from Object.)

IIf(Boolean, Object, 

Object)

Returns one of two objects, depending on the evaluation of an

expression.

InputBox(String, String, 

String, Int32, Int32)

Displays a prompt in a dialog box, waits for the user to input text or

click a button, and then returns a string containing the contents of the

text box.

MsgBox(Object, 

MsgBoxStyle, Object)

Displays a message in a dialog box, waits for the user to click a button,

and then returns an integer indicating which button the user clicked.

Partition(Int64, Int64, 

Int64, Int64)

Returns a string representing the calculated range that contains a

number.

Interaction Class (Microsoft.VisualBasic) https://msdn.microsoft.com/en-us/library/microsoft.visualbasic.interactio...

2 of 4 04.09.2016 1:09

Page 16: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

SaveSetting(String, 

String, String, String)

Saves or creates an application entry in the Windows registry. The My

feature gives you greater productivity and performance in registry

operations than SaveSetting. For more information, see Registry.

Shell(String, 

AppWinStyle, Boolean, 

Int32)

Runs an executable program and returns an integer containing the

program's process ID if it is still running.

Switch(Object()) Evaluates a list of expressions and returns an Object value

corresponding to the first expression in the list that is True.

ToString() Returns a string that represents the current object.(Inherited from

Object.)

RemarksThis module supports the Visual Basic language keywords and run-time library members that run other programs, call a

method or property, sound a beep from the computer, provide a command-line string, manipulate COM objects, and

control dialog boxes.

ExamplesThe following example uses the Shell function to run an application specified by the user. Specifying

AppWinStyle.NormalFocus as the second argument opens the application in normal size and gives it the focus.

Version Information.NET Framework

Available since 1.1

Silverlight

Available since 2.0

Thread SafetyAny public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed

Dim procID As Integer

' Run calculator.

procID = Shell("C:\Windows\system32\calc.exe", AppWinStyle.NormalFocus)

' The preceding path is for Windows XP.

' The Windows 2000 path is C:\WINNT\system32\calc.exe.

Interaction Class (Microsoft.VisualBasic) https://msdn.microsoft.com/en-us/library/microsoft.visualbasic.interactio...

3 of 4 04.09.2016 1:09

Page 17: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

to be thread safe.

See AlsoMicrosoft.VisualBasic Namespace

Information and Interaction Summary (Visual Basic)

Keywords (Visual Basic)

Visual Basic Runtime Library Members

Return to top

© 2016 Microsoft

Interaction Class (Microsoft.VisualBasic) https://msdn.microsoft.com/en-us/library/microsoft.visualbasic.interactio...

4 of 4 04.09.2016 1:09

Page 18: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

FileSystem Class

 

The FileSystem module contains the procedures that are used to perform file, directory or folder, and system operations.

The My feature gives you better productivity and performance in file I/O operations than using the FileSystem module. For

more information, see FileSystem.

Namespace:   Microsoft.VisualBasic

Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

Inheritance HierarchySystem.Object

  Microsoft.VisualBasic.FileSystem

Syntax

Methods

Name Description

ChDir(String) Changes the current directory or folder. The My feature gives you

better productivity and performance in file I/O operations than the

ChDir function. For more information, see CurrentDirectory .

ChDrive(Char) Changes the current drive.

ChDrive(String) Changes the current drive.

CurDir() Returns a string representing the current path. The FileSystem gives

you better productivity and performance in file I/O operations than

.NET Framework (current version)

<StandardModuleAttribute>

<SecurityCriticalAttribute>

<HostProtectionAttribute(SecurityAction.LinkDemand, Resources :=

HostProtectionResource.ExternalProcessMgmt)>

Public NotInheritable Class FileSystem

VB

FileSystem Class (Microsoft.VisualBasic) https://msdn.microsoft.com/en-us/library/microsoft.visualbasic.filesystem...

1 of 9 04.09.2016 0:23

Page 19: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

CurDir. For more information, see CurrentDirectory.

CurDir(Char) Returns a string representing the current path. The FileSystem gives

you better productivity and performance in file I/O operations than

CurDir. For more information, see CurrentDirectory.

Dir() Returns a string representing the name of a file, directory, or folder

that matches a specified pattern or file attribute, or the volume label

of a drive. The FileSystem gives you better productivity and

performance in file I/O operations than the Dir function. See

GetDirectoryInfo for more information.

Dir(String, FileAttribute) Returns a string representing the name of a file, directory, or folder

that matches a specified pattern or file attribute, or the volume label

of a drive. The FileSystem gives you better productivity and

performance in file I/O operations than the Dir function. See

GetDirectoryInfo for more information.

EOF(Int32) Returns a Boolean value True when the end of a file opened for

Random or sequential Input has been reached.

Equals(Object) Determines whether the specified object is equal to the current

object.(Inherited from Object.)

FileAttr(Int32) Returns an enumeration representing the file mode for files opened

using the FileOpen function. The FileSystem gives you better

productivity and performance in file I/O operations than the FileAttr

function. See GetFileInfo for more information.

FileClose(Int32()) Concludes input/output (I/O) to a file opened using the FileOpen

function. My gives you better productivity and performance in file

I/O operations. See FileSystem for more information.

FileCopy(String, String) Copies a file. The FileSystem gives you better productivity and

performance in file I/O operations than FileCopy. See CopyFile for

more information.

FileDateTime(String) Returns a Date value that indicates the date and time a file was

written to. The My feature gives you better productivity and

performance in file I/O operations than FileDateTime. For more

information, see GetFileInfo

FileGet(Int32, Array, Int64, 

Boolean, Boolean)

Reads data from an open disk file into a variable. The My feature

gives you better productivity and performance in file I/O operations

than FileGet. For more information, see FileSystem.

FileGet(Int32, Boolean, 

Int64)

Reads data from an open disk file into a variable. The My feature

gives you better productivity and performance in file I/O operations

than FileGet. For more information, see FileSystem

FileSystem Class (Microsoft.VisualBasic) https://msdn.microsoft.com/en-us/library/microsoft.visualbasic.filesystem...

2 of 9 04.09.2016 0:23

Page 20: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

FileGet(Int32, Byte, Int64) Reads data from an open disk file into a variable. The My feature

gives you better productivity and performance in file I/O operations

than FileGet. For more information, see FileSystem.

FileGet(Int32, Char, Int64) Reads data from an open disk file into a variable. The My feature

gives you better productivity and performance in file I/O operations

than FileGet. For more information, see FileSystem.

FileGet(Int32, DateTime, 

Int64)

Reads data from an open disk file into a variable. The My feature

gives you better productivity and performance in file I/O operations

than FileGet. For more information, see FileSystem.

FileGet(Int32, Decimal, 

Int64)

Reads data from an open disk file into a variable. The My feature

gives you better productivity and performance in file I/O operations

than FileGet. For more information, see FileSystem.

FileGet(Int32, Double, 

Int64)

Reads data from an open disk file into a variable. The My feature

gives you better productivity and performance in file I/O operations

than FileGet. For more information, see FileSystem.

FileGet(Int32, Int16, Int64) Reads data from an open disk file into a variable. The My feature

gives you better productivity and performance in file I/O operations

than FileGet. For more information, see FileSystem.

FileGet(Int32, Int32, Int64) Reads data from an open disk file into a variable. The My feature

gives you better productivity and performance in file I/O operations

than FileGet. For more information, see FileSystem.

FileGet(Int32, Int64, Int64) Reads data from an open disk file into a variable. The My feature

gives you better productivity and performance in file I/O operations

than FileGet. For more information, see FileSystem.

FileGet(Int32, Single, Int64) Reads data from an open disk file into a variable. The My feature

gives you better productivity and performance in file I/O operations

than FileGet. For more information, see FileSystem.

FileGet(Int32, String, Int64, 

Boolean)

Reads data from an open disk file into a variable. The My feature

gives you better productivity and performance in file I/O operations

than FileGet. For more information, see FileSystem.

FileGet(Int32, ValueType, 

Int64)

Reads data from an open disk file into a variable. The My feature

gives you better productivity and performance in file I/O operations

than FileGet. For more information, see FileSystem.

FileGetObject(Int32, 

Object, Int64)

Reads data from an open disk file into a variable. The My feature

gives you better productivity and performance in file I/O operations

than FileGetObject. For more information, see FileSystem.

FileLen(String) Returns a Long value that specifies the length of a file in bytes. The

My feature gives you better productivity and performance in file I/O

FileSystem Class (Microsoft.VisualBasic) https://msdn.microsoft.com/en-us/library/microsoft.visualbasic.filesystem...

3 of 9 04.09.2016 0:23

Page 21: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

operations than FileLen. For more information, see GetFileInfo.

FileOpen(Int32, String, 

OpenMode, OpenAccess, 

OpenShare, Int32)

Opens a file for input or output. The My feature gives you better

productivity and performance in file I/O operations than FileOpen.

For more information, see FileSystem.

FilePut(Int32, Array, Int64, 

Boolean, Boolean)

Writes data from a variable to a disk file. The My feature gives you

better productivity and performance in file I/O operations than

FilePut. For more information, see FileSystem.

FilePut(Int32, Boolean, 

Int64)

Writes data from a variable to a disk file. The My feature gives you

better productivity and performance in file I/O operations than

FilePut. For more information, see FileSystem.

FilePut(Int32, Byte, Int64) Writes data from a variable to a disk file. The My feature gives you

better productivity and performance in file I/O operations than

FilePut. For more information, see FileSystem.

FilePut(Int32, Char, Int64) Writes data from a variable to a disk file. The My feature gives you

better productivity and performance in file I/O operations than

FilePut. For more information, see FileSystem.

FilePut(Int32, DateTime, 

Int64)

Writes data from a variable to a disk file. The My feature gives you

better productivity and performance in file I/O operations than

FilePut. For more information, see FileSystem.

FilePut(Int32, Decimal, 

Int64)

Writes data from a variable to a disk file. The My feature gives you

better productivity and performance in file I/O operations than

FilePut. For more information, see FileSystem.

FilePut(Int32, Double, 

Int64)

Writes data from a variable to a disk file. The My feature gives you

better productivity and performance in file I/O operations than

FilePut. For more information, see FileSystem.

FilePut(Int32, Int16, Int64) Writes data from a variable to a disk file. The My feature gives you

better productivity and performance in file I/O operations than

FilePut. For more information, see FileSystem.

FilePut(Int32, Int32, Int64) Writes data from a variable to a disk file. The My feature gives you

better productivity and performance in file I/O operations than

FilePut. For more information, see FileSystem.

FilePut(Int32, Int64, Int64) Writes data from a variable to a disk file. The My feature gives you

better productivity and performance in file I/O operations than

FilePut. For more information, see FileSystem.

FilePut(Int32, Single, Int64) Writes data from a variable to a disk file. The My feature gives you

better productivity and performance in file I/O operations than

FilePut. For more information, see FileSystem.

FileSystem Class (Microsoft.VisualBasic) https://msdn.microsoft.com/en-us/library/microsoft.visualbasic.filesystem...

4 of 9 04.09.2016 0:23

Page 22: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

FilePut(Int32, String, Int64, 

Boolean)

Writes data from a variable to a disk file. The My feature gives you

better productivity and performance in file I/O operations than

FilePut. For more information, see FileSystem..

FilePut(Int32, ValueType, 

Int64)

Writes data from a variable to a disk file. The My feature gives you

better productivity and performance in file I/O operations than

FilePut. For more information, see FileSystem.

FilePut(Object, Object, 

Object)

Obsolete.Writes data from a variable to a disk file. The My feature

gives you better productivity and performance in file I/O operations

than FilePut. For more information, see FileSystem.

FilePutObject(Int32, 

Object, Int64)

Writes data from a variable to a disk file. The My feature gives you

better productivity and performance in file I/O operations than

FilePutObject. For more information, see FileSystem.

FileWidth(Int32, Int32) Assigns an output line width to a file opened by using the FileOpen

function.

FreeFile() Returns an Integer value that represents the next file number

available for use by the FileOpen function.

GetAttr(String) Returns a FileAttribute value that represents the attributes of a file,

directory, or folder. The My feature gives you better productivity and

performance in file I/O operations than FileAttribute. For more

information, see FileSystem.

GetHashCode() Serves as the default hash function. (Inherited from Object.)

GetType() Gets the Type of the current instance.(Inherited from Object.)

Input(Int32, Boolean) Reads data from an open sequential file and assigns the data to

variables.

Input(Int32, Byte) Reads data from an open sequential file and assigns the data to

variables.

Input(Int32, Char) Reads data from an open sequential file and assigns the data to

variables.

Input(Int32, DateTime) Reads data from an open sequential file and assigns the data to

variables.

Input(Int32, Decimal) Reads data from an open sequential file and assigns the data to

variables.

Input(Int32, Double) Reads data from an open sequential file and assigns the data to

variables.

FileSystem Class (Microsoft.VisualBasic) https://msdn.microsoft.com/en-us/library/microsoft.visualbasic.filesystem...

5 of 9 04.09.2016 0:23

Page 23: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

Input(Int32, Int16) Reads data from an open sequential file and assigns the data to

variables.

Input(Int32, Int32) Reads data from an open sequential file and assigns the data to

variables.

Input(Int32, Int64) Reads data from an open sequential file and assigns the data to

variables.

Input(Int32, Object) Reads data from an open sequential file and assigns the data to

variables.

Input(Int32, Single) Reads data from an open sequential file and assigns the data to

variables.

Input(Int32, String) Reads data from an open sequential file and assigns the data to

variables.

InputString(Int32, Int32) Returns String value that contains characters from a file opened in

Input or Binary mode. The My feature gives you better productivity

and performance in file I/O operations than InputString. For more

information, see FileSystem.

Kill(String) Deletes files from a disk. The My feature gives you better productivity

and performance in file I/O operations than Kill. For more

information, see FileSystem .

LineInput(Int32) Reads a single line from an open sequential file and assigns it to a

String variable.

Loc(Int32) Returns a Long value that specifies the current read/write position in

an open file.

Lock(Int32) Controls access by other processes to all or part of a file opened by

using the Open function. The My feature gives you better

productivity and performance in file I/O operations than Lock and

Unlock. For more information, see FileSystem.

Lock(Int32, Int64) Controls access by other processes to all or part of a file opened by

using the Open function. The My feature gives you better

productivity and performance in file I/O operations than Lock and

Unlock. For more information, see FileSystem.

Lock(Int32, Int64, Int64) Controls access by other processes to all or part of a file opened by

using the Open function. The My feature gives you better

productivity and performance in file I/O operations than Lock and

Unlock. For more information, see FileSystem.

LOF(Int32) Returns a Long representing the size, in bytes, of a file opened by

FileSystem Class (Microsoft.VisualBasic) https://msdn.microsoft.com/en-us/library/microsoft.visualbasic.filesystem...

6 of 9 04.09.2016 0:23

Page 24: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

using the FileOpen function. The My feature gives you better

productivity and performance in file I/O operations than LOF. For

more information, see FileSystem.

MkDir(String) Creates a new directory. The My feature gives you better productivity

and performance in file I/O operations than MkDir. For more

information, see CreateDirectory.

Print(Int32, Object()) Writes display-formatted data to a sequential file.

PrintLine(Int32, Object()) Writes display-formatted data to a sequential file.

Rename(String, String) Renames a disk file or directory. The My feature gives you better

productivity and performance in file I/O operations than Rename.

For more information, see FileSystem.

Reset() Closes all disk files opened by using the FileOpen function. The My

feature gives you better productivity and performance in file I/O

operations than Reset. For more information, see FileSystem.

RmDir(String) Removes an existing directory. The My feature gives you better

productivity and performance in file I/O operations than RmDir. For

more information, see DeleteDirectory.

Seek(Int32) Returns a Long specifying the current read/write position in a file

opened by using the FileOpen function, or sets the position for the

next read/write operation in a file opened by using the FileOpen

function. The My feature gives you better productivity and

performance in file I/O operations than Seek. For more information,

see FileSystem.

Seek(Int32, Int64) Returns a Long specifying the current read/write position in a file

opened by using the FileOpen function, or sets the position for the

next read/write operation in a file opened by using the FileOpen

function. The My feature gives you better productivity and

performance in file I/O operations than Seek. For more information,

see FileSystem.

SetAttr(String, FileAttribute) Sets attribute information for a file. The My feature gives you better

productivity and performance in file I/O operations than SetAttr. For

more information, see FileSystem.

SPC(Int16) Used with the Print or PrintLine function to position output.

TAB() Used with the Print or PrintLine functions to position output.

TAB(Int16) Used with the Print or PrintLine functions to position output.

ToString() Returns a string that represents the current object.(Inherited from

FileSystem Class (Microsoft.VisualBasic) https://msdn.microsoft.com/en-us/library/microsoft.visualbasic.filesystem...

7 of 9 04.09.2016 0:23

Page 25: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

Object.)

Unlock(Int32) Controls access by other processes to all or part of a file opened by

using the Open function. The My feature gives you better

productivity and performance in file I/O operations than Lock and

Unlock. For more information, see FileSystem.

Unlock(Int32, Int64) Controls access by other processes to all or part of a file opened by

using the Open function. The My feature gives you better

productivity and performance in file I/O operations than Lock and

Unlock. For more information, see FileSystem.

Unlock(Int32, Int64, Int64) Controls access by other processes to all or part of a file opened by

using the Open function. The My feature gives you better

productivity and performance in file I/O operations than Lock and

Unlock. For more information, see FileSystem.

Write(Int32, Object()) Writes data to a sequential file. Data written with Write is usually read

from a file by using Input.

WriteLine(Int32, Object()) Writes data to a sequential file. Data written with Write is usually read

from a file by using Input.

RemarksThis module supports the Visual Basic language keywords and run-time library members that access files and folders.

ExamplesThis example uses the GetAttr function to determine the attributes of a file and directory or folder.

Dim MyAttr As FileAttribute

' Assume file TESTFILE is normal and readonly.

MyAttr = GetAttr("C:\TESTFILE.txt") ' Returns vbNormal.

' Test for normal.

If (MyAttr And FileAttribute.Normal) = FileAttribute.Normal Then

MsgBox("This file is normal.")

End If

' Test for normal and readonly.

Dim normalReadonly As FileAttribute

normalReadonly = FileAttribute.Normal Or FileAttribute.ReadOnly

If (MyAttr And normalReadonly) = normalReadonly Then

MsgBox("This file is normal and readonly.")

VB

FileSystem Class (Microsoft.VisualBasic) https://msdn.microsoft.com/en-us/library/microsoft.visualbasic.filesystem...

8 of 9 04.09.2016 0:23

Page 26: Development with My 1 Visual Basic run-time - vb-net.comvb-net.com/VB2015/Language/VB My.pdf · vbVolume vbWednesday vbWide vbYes vbYesNo vbYesNoCancel

Version Information.NET Framework

Available since 1.1

Thread SafetyAny public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed

to be thread safe.

See AlsoMicrosoft.VisualBasic Namespace

Directories and Files Summary (Visual Basic)

Input and Output Summary (Visual Basic)

Keywords (Visual Basic)

Visual Basic Runtime Library Members

Return to top

© 2016 Microsoft

End If

' Assume MYDIR is a directory or folder.

MyAttr = GetAttr("C:\MYDIR")

If (MyAttr And FileAttribute.Directory) = FileAttribute.Directory Then

MsgBox("MYDIR is a directory")

End If

FileSystem Class (Microsoft.VisualBasic) https://msdn.microsoft.com/en-us/library/microsoft.visualbasic.filesystem...

9 of 9 04.09.2016 0:23