2016年1月4日 星期一

VB筆記本

使用HTML色彩顏色
x.ForeColor = ColorTranslator.FromHtml("#dddddd")


取得MasterPage中的控制項
Dim p_empno As String = CType(Master.FindControl("ContentPlaceHolder1").FindControl("lb_empno"), Label).Text


例外狀況 指定到程式的某一個位置可用GOTO
GOTO line
line:


DataTable寫入與讀取
https://dotblogs.com.tw/joysdw12/archive/2010/11/09/19294.aspx 

http://blog.xuite.net/xiaolian/blog/57944397-%E3%80%90VB%E3%80%91%E6%89%8B%E5%8B%95%E5%BB%BA%E7%AB%8BDataTable


Dim table1 As New DataTable
table1.Columns.Add("date")

table1.Rows.Add(myDateStr.Text)

Dim dataTxt As String = table1.Select("date='" & table1.Rows(i)("date") & "'")(0)("date").ToString()
Dim number As Integer = table1.Compute("count(date)", "date='" & dataTxt & "'")


取得本網站的位址

Dim appPath As String = Request.PhysicalApplicationPath '


建立可以回傳多值得方法
1.先建立一個類別
Public Class PRDLC
        Public RDLC_CODE As String
        Public RDLC_SIZE As String

End Class

2.將資料傳入類別中
Public Sub Pvt_CODE(RDLCName As String)
    ....
    Dim rdlc As New RDLC
    rdlc.RDLC_CODE = Lv_sCODE
    rdlc.RDLC_SIZE = Lv_sSIZE

End Sub

3.調用資料
Public Sub loadData()
    Pvt_CODE("參數")
    Dim Lv_classRDLC As New RDLC
    Dim aa As String = Lv_classRDLC.RDLC_CODE
    Dim bb As String = Lv_classRDLC.RDLC_SIZE

...

計算程式執行時間
Dim dteStart As DateTime = Now
  .... 運行的程式內容.....
Dim TS As TimeSpan = Now.Subtract(dteStart)
MessageBox.Show("執行時間: " & TS.TotalSeconds & " 秒")



沒有留言:

張貼留言