アットウィキロゴ
SQLの窓
掲示板 掲示板 ページ検索 ページ検索 メニュー メニュー
「SyntaxHighlighter」の編集履歴(バックアップ)一覧に戻る

SyntaxHighlighter - (2008/05/19 (月) 18:09:45) のソース

#setmenu(スタートアップメニュー)
*&this_page()

#include_js(http://winofsql.sakura.ne.jp/system/js/shCore.js)
#include_js(http://winofsql.sakura.ne.jp/system/js/shBrushVb.js)

#html2(){{
<textarea name="code" class="vb">  
Public Class Form1

	Dim obj As New Microsoft.Office.Interop.Excel.ApplicationClass
	Dim books As Microsoft.Office.Interop.Excel.Workbooks
	Dim book As Microsoft.Office.Interop.Excel.Workbook

	' **************************************************
	' 一つ一つ取得( 後でリリース用 )
	' グローバルで使用するオブジェクト
	' **************************************************
	Private Sub Button1_Click(ByVal sender As System.Object, _
	ByVal e As System.EventArgs) Handles Button1.Click

		books = obj.Workbooks
		book = books.Open("C:\user\book1.xls")
		obj.Visible = True

	End Sub


	' **************************************************
	' セルにデータセット
	' **************************************************
	Private Sub Button3_Click(ByVal sender As System.Object, _
	ByVal e As System.EventArgs) Handles Button3.Click

		book.Saved = True
		obj.Quit()

		'ひとつ一つリリース
		'System.Runtime.InteropServices.Marshal.ReleaseComObject(book)
		'System.Runtime.InteropServices.Marshal.ReleaseComObject(books)
		'System.Runtime.InteropServices.Marshal.ReleaseComObject(obj)

		' 一括キャンセル
		obj = Nothing
		GC.Collect()


	End Sub

	' **************************************************
	' セルにデータセット
	' ブロック内でオブジェクトを使用後リリースする
	' **************************************************
	Private Sub Button4_Click(ByVal sender As System.Object, _
	 ByVal e As System.EventArgs) Handles Button4.Click

		' book.Sheets("Sheet1").Cells(10, 10) = "文字列"
		Dim A, B, C As Object
		A = book.Sheets
		B = A("Sheet1")
		C = B.Cells
		C(10, 10) = "文字列"

		System.Runtime.InteropServices.Marshal.ReleaseComObject(C)
		System.Runtime.InteropServices.Marshal.ReleaseComObject(B)
		System.Runtime.InteropServices.Marshal.ReleaseComObject(A)

	End Sub

End Class
</textarea>  
}}

#javascript(){{
dp.SyntaxHighlighter.ClipboardSwf = '/clipboard.swf';
dp.SyntaxHighlighter.HighlightAll('code');

}}


----
記事メニュー
最近更新されたスレッド
ウィキ募集バナー