Author:水如煙日誌的實現:MethodLogAttribute.vbNamespace uRemoting.MethodWatcher <AttributeUsage(AttributeTargets.Class)> _ Public Class MethodLogAttribute Inherits MethodWatcherBaseAttribute Protected Overrides Function GetMethodWatc
Author:水如煙現在發現,熟悉NET提供的靜態方法是很重要的,不熟悉不熟知,會走好多彎路.當然,走彎路也不是壞事,只是時間有限,經驗和技能不能在彎路中積累.下面的功能是看看指定類所在的程式集究竟公布了哪些靜態方法.Imports System.ReflectionPublic Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Author:水如煙 程式中若開啟了一個Workbook給使用者直接操作,那麼,使用者有可能將Workbook關閉了甚至退出了整個ExcelApplicatoin。可以通過以下方法防止這種情形(這個問題留意的人較少,故發首頁):Imports Microsoft.Office.InteropPublic Class Form1 Private gWorkbookCanClose As Boolean = False Private Sub Button1_Click(ByVal s
Author:水如煙 出現這個情形,是在重寫了Finalize並在裡面含有調用Com對象的代碼,同時在銷毀對象前沒有顯式釋放Com對象。解決的辦法是,顯式調用釋放代碼。如:Public Sub Quit() ...End SubProtected Overridable Sub Dispose(ByVal disposing As Boolean) If Not Me.disposedValue Then If disposing Then If
Author:水如煙 需要引用System.Management空間再Imports System.Management使用: Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click For Each printer As String In PrinterService.GetPrinterNames(".")
Author:水如煙 Public Class RestartProgramService Private Shared gAppLocation As String Public Shared Sub Run() AddHandler AppDomain.CurrentDomain.ProcessExit, AddressOf AppDomain_ProcessExit gAppLocation = Reflection.Assembly.GetEnt
Author:水如煙使用ManagementClass。下面的樣本是檢索硬碟資訊的。 Private Sub Button1_Click()Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim disks As New ManagementClass("Win32_DiskDrive") Dim observe
Author:水如煙Public Class uStringClass uString Private Shared gEncoding As System.Text.Encoding = System.Text.Encoding.GetEncoding("GB2312") Public Shared Property Encoding()Property Encoding() As System.Text.Encoding Get Return