Take a Quick Look at a File
The Windows Script Host (WSH) supports many useful features, including VBScript’s FileSystemObject object and the ability to drag and drop filenames. You can drag and drop a data files icon
The Windows Script Host (WSH) supports many useful features, including VBScript’s FileSystemObject object and the ability to drag and drop filenames. You can drag and drop a data files icon
‘ Invoke a method via reflection and return its result – return null if method ‘ doesn’t exist or throws’ Note: requires Imports System.Reflection” Example:’ Function GetCompleteName(ByVal firstName As String,’
‘ Return the value of the public field with the specified name,’ defined inside the obj object’ Note: requires Imports System.Reflection” Example:’ Public TestField As String = “hello”‘ …’ MessageBox.Show(GetField(Me,
‘ Read a property via reflection or return a default value’ Example: MessageBox.Show(GetProperty(Button1, “Text”, “”))Function GetProperty(ByVal obj As Object, ByVal propertyName As String, _ ByVal defaultValue As Object) As Object
‘ Set a property via reflection and return True if successful’ Example: SetProperty(Button1, “Text”, “Click me”)Function SetProperty(ByVal obj As Object, ByVal propertyName As String, _ ByVal val As Object) As
‘ Check whether an object supports a member with the specified name” Examples:’ Debug.WriteLine(IsMemberSupported(Button1, “BackColor”)) ‘ => True’ Debug.WriteLine(IsMemberSupported(Button1, “Focus”)) ‘ => True’ Debug.WriteLine(IsMemberSupported(Button1, “TextColor”)) ‘ => False’ Debug.WriteLine(IsMemberSupported(Button1, “Print”))
‘ Return the application’s path.’ Note: it also works with add-ins’s dll, whereas Application.StartupPath ‘ returns’ Visual Studio .NET’s startup path instead’ Example: MessageBox.Show(GetApplicationPath())Function GetApplicationPath() As String Return System.IO.Path.GetDirectoryName _
‘ Check whether an object is storing a numeric value’ Examples:’ Dim s As String = “hello”‘ Dim d As Double = 2.4′ Dim i As Integer = 5’ Debug.WriteLine(IsNumeric(d))
‘ Return a validation summary string with all the error messages, if any,’ of the controls inside the specified container,’ associated to an ErrorProvider control’ ‘ Example:’ Dim summary As