VB.Net by API/System/Environment — различия между версиями

Материал из VB Эксперт
Перейти к: навигация, поиск
м (1 версия)
 
м (1 версия)
 
(нет различий)

Текущая версия на 12:51, 26 мая 2010

Environment.CommandLine

  
Imports System
Public Class MainClass
   Shared Sub Main()
        Console.WriteLine("CommandLine:        " & System.Environment.rumandLine )
   End Sub 
End Class


Environment.CurrentDirectory

  
Imports System

Public Class MainClass
   Shared Sub Main()
        Console.WriteLine("CurrentDirectory:   " & System.Environment.CurrentDirectory )
   End Sub 
End Class


Environment.Exit

  
Public Class MainClass
   Shared Sub Main()
      System.Environment.Exit(System.Environment.ExitCode)
   End Sub " ValidationError
End Class


Environment.ExitCode

  
Imports System

Public Class MainClass
   Shared Sub Main()
        Console.WriteLine("ExitCode:           " & System.Environment.ExitCode )
   End Sub 
End Class


Environment.GetCommandLineArgs

  
        
Module Module1
    Sub Main(ByVal cmdArgs() As String)
        If Environment.GetCommandLineArgs.Length > 0 Then
            For Each strArg As String In Environment.GetCommandLineArgs
                "Process the arguments here.
                Console.WriteLine(strArg)
            Next strArg
        End If
    End Sub

End Module


Environment.GetLogicalDrives

  
Namespace MyApp.Info
    Module Main
        Sub Main()
            Dim objHW As New MyApp.Info.Utilities
            objHW.DisplayData()
        End Sub
    End Module
    Public Class Utilities
        "Run the application
        Public Sub DisplayData()
            Console.WriteLine(Environment.MachineName)
            Console.WriteLine(Environment.SystemDirectory)
            Console.WriteLine(Environment.GetLogicalDrives())
            Console.WriteLine(Environment.Version.ToString())
        End Sub
    End Class
End Namespace


Environment.HasShutdownStarted

  
Imports System

Public Class MainClass
   Shared Sub Main()
        Console.WriteLine("HasShutdownStarted: " & System.Environment.HasShutdownStarted )
   End Sub 
End Class


Environment.MachineName

  
Namespace MyApp.Info
    Module Main
        Sub Main()
            Dim objHW As New MyApp.Info.Utilities
            objHW.DisplayData()
        End Sub
    End Module
    Public Class Utilities
        "Run the application
        Public Sub DisplayData()
            Console.WriteLine(Environment.MachineName)
            Console.WriteLine(Environment.SystemDirectory)
            Console.WriteLine(Environment.GetLogicalDrives())
            Console.WriteLine(Environment.Version.ToString())
        End Sub
    End Class
End Namespace


Environment.NewLine

  
Imports System

Public Class MainClass
   Shared Sub Main()
        Console.WriteLine("NewLine:            " & System.Environment.NewLine)
   End Sub 
End Class


Environment.OSVersion

  
 
Imports System
Public Class Step3
     Shared Sub Main()
          System.Console.WriteLine(System.Environment.OSVersion.ToString())
     End Sub
End Class


Environment.ProcessorCount

  
Imports System

Public Class MainClass
   Shared Sub Main()
        Console.WriteLine("ProcessorCount:     " & System.Environment.ProcessorCount)
   End Sub 
End Class


Environment.SpecialFolder.CommonProgramFiles

  
Imports System.Windows.Forms
public class FolderBrowserDialogProperty
   public Shared Sub Main
        Dim FolderBrowserDialog1 As FolderBrowserDialog = New System.Windows.Forms.FolderBrowserDialog
        With FolderBrowserDialog1
            .RootFolder = Environment.SpecialFolder.rumonProgramFiles
            .SelectedPath = "C:\Temp"
            .ShowNewFolderButton = False
            .Description = "Use the tree below to select a folder:"
        End With
        If FolderBrowserDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
            Console.WriteLine(FolderBrowserDialog1.SelectedPath)
        End If
   End Sub
End class


Environment.SpecialFolder.Favorites

  
Imports System
Imports System.Drawing
Imports System.Data
Imports System.IO
Imports System.Collections
Imports System.Windows.Forms
Imports System.Drawing.Printing
Public Class MainClass
    Shared Sub Main()
      Console.WriteLine(Environment.GetFolderPath(Environment.SpecialFolder.Favorites))
    End Sub
End Class


Environment.StackTrace

  
Imports System

Public Class MainClass
   Shared Sub Main()
        Console.WriteLine("StackTrace:         " & System.Environment.StackTrace )
   End Sub 
End Class


Environment.SystemDirectory

  
Namespace MyApp.Info
    Module Main
        Sub Main()
            Dim objHW As New MyApp.Info.Utilities
            objHW.DisplayData()
        End Sub
    End Module
    Public Class Utilities
        "Run the application
        Public Sub DisplayData()
            Console.WriteLine(Environment.MachineName)
            Console.WriteLine(Environment.SystemDirectory)
            Console.WriteLine(Environment.GetLogicalDrives())
            Console.WriteLine(Environment.Version.ToString())
        End Sub
    End Class
End Namespace


Environment.TickCount

  
Option Strict On
Public Module TimerFunction
   Public Sub Main()
      Dim starttime, endtime As Integer
      starttime = Environment.TickCount
      For ctr As Integer = 0 to 10000000
      Next
      endtime = Environment.TickCount
      Console.WriteLine("Elapsed time is {0} milliseconds", endtime - starttime)
   End Sub
End Module


Environment.UserDomainName

  
Imports System

Public Class MainClass
   Shared Sub Main()
        Console.WriteLine("UserDomainName:     " & System.Environment.UserDomainName)
   End Sub 
End Class


Environment.UserInteractive

  

Imports System

Public Class MainClass
   Shared Sub Main()
        Console.WriteLine("UserInteractive:    " & System.Environment.UserInteractive)
   End Sub 
End Class


Environment.UserName

  
 
Public Class LoopPerformance
    Shared Sub Main()
        Console.WriteLine(System.Environment.UserName)
    
    End Sub
End Class


Environment.Version

  
Namespace MyApp.Info
    Module Main
        Sub Main()
            Dim objHW As New MyApp.Info.Utilities
            objHW.DisplayData()
        End Sub
    End Module
    Public Class Utilities
        "Run the application
        Public Sub DisplayData()
            Console.WriteLine(Environment.MachineName)
            Console.WriteLine(Environment.SystemDirectory)
            Console.WriteLine(Environment.GetLogicalDrives())
            Console.WriteLine(Environment.Version.ToString())
        End Sub
    End Class
End Namespace


Environment.WorkingSet

  
Imports System

Public Class MainClass
   Shared Sub Main()
        Console.WriteLine("WorkingSet:         " & System.Environment.WorkingSet)
   End Sub 
End Class