vb.net_study

 

 

0:添加控件屬性

Me.btnDEL.Attributes("onClick") =要進行的js操作動作

Me.btnDEL.Attributes("onClick",要進行的js操作動作)

兩則有同樣的效果!

 

1:JS,VS中取到一個文件,並判斷它的大小,長度

(js)

var fso = new ActiveXObject('Scripting.FileSystemObject');

var file = fso.GetFile(document.FrmDataAll.txtUpFilePathC.value);

var filesize= file.size;(注解:2M=2*(1024*1024))

(vs)

Set objFS = CreateObject("Scripting.FileSystemObject")

objFS.GetFile(filepath)

objFS.FileExists(filepath)

objFS.DeleteFile(filepath)

2:如果運用ftp上傳文件及其實操作(vs中)

設定參數的部分:

    SET gobjftp =CreateObject("ftpObject.FtpClass")

    gobjftp.FtpUsrID =strUserID

    gobjftp.FtpPassWord =strpwd

FTP_TRANSFER_TYPE_BINARY = &H2

    wsRcvNum=0

實際連接的部分:

If gobjftp.ConnectFtpSite(strftpSvrname) = "Success" Then

        If gobjftp.SetCurrentDir(strftpPath) <> "Success" Then         

            gobjftp.CreateDir(strftpPath)

            gobjftp.CreateDir(strftpPath & stryear)

        End If 

        If gobjftp.SetCurrentDir(strftpPath & stryear & "/" & strunit) <> "Success" Then

            gobjftp.CreateDir(strftpPath & stryear & "/" & strunit)

        End If

        gobjftp.PutFile oldfilepath,strftpPath & stryear & "/" & strunit & "/" & wsFileName

        wsRcvNum=1

關連接的部分:

    gobjftp.CloseFtpConnect

End if

Download_file=wsRcvNum

3:運用word對文件進行操作:(vs)

    Set myDocs = CreateObject("Word.Application")

    myDocs.Visible = TRUE----是否顯示文檔內容

    myDocs.Documents.Open(msTEMP_RTF1)----打開文件

myDocs.printout()-----進行列印

    set myDocs=nothing

4:option數據重新bind(js)

        newOpt=new Option('','');

    objUSER.options[0]=newOpt;

    var temp=tempxmlRtn.split("**"); 

    for (var i=0;i<temp.length;i++)

    {

        var subtemp=temp[i].split("##");

        newOpt=new Option(subtemp[1],subtemp[0]);//new Option(text,value)

        objUSER.options[i+1]=newOpt;

}

5:option數據重新bind(APS.NET)

Dim li As ListItem = New ListItem

    li.Value = "0"

    li.Text = "0─密等以上"

    cboSOURCE_SCUR.Items.Insert(1, li)

    象這樣子一個個插入就可以了!

6:取到系統日期,時間(APS.NET)

    Dim Source_Date As String

    Source_Date = DateTime.Now.ToString("yyyy/MM/dd")---取在西元年

AP_CDATE = Format(CInt(Source_Date.Substring(0, Source_Date.IndexOf("/"))) - 1911, "000") + Source_Date.Substring(Source_Date.IndexOf("/"))---取在民國年

Dim Source_Time as sring

Source_Time =DateTime.Now.ToString("HH:mm:ss")---系統時間

 

Dim strDate As String = Format(DateTime.Now.Year() - 1911, "000") + "/" + DateTime.Now.ToString("MM") + "/" + DateTime.Now.ToString("dd")

Dim strTime As String = DateTime.Now.ToString("HH") + ":" + DateTime.Now.ToString("mm") + ":" + DateTime.Now.ToString("ss")

7:設定一個控件的class及替代字符,重新編碼(js)

        document.FrmDataAll.txtPROC_DAYS.className="distext";

     StrNAE.replace('<ID>','').replace('</ID>','');

    STRTEST=Escape(TEST);---重新編碼

posted on 2006-04-11 21:40  freeliver54  阅读(325)  评论(0编辑  收藏  举报

导航