并無快捷方式,記住控件名稱,
成都創(chuàng)新互聯(lián)專注于網(wǎng)站建設|成都網(wǎng)站維護|優(yōu)化|托管以及網(wǎng)絡推廣,積累了大量的網(wǎng)站設計與制作經(jīng)驗,為許多企業(yè)提供了網(wǎng)站定制設計服務,案例作品覆蓋格柵板等行業(yè)。能根據(jù)企業(yè)所處的行業(yè)與銷售的產(chǎn)品,結(jié)合品牌形象的塑造,量身開發(fā)品質(zhì)網(wǎng)站。
然后在From1[設計]的屬性面板最上方的下拉框中尋找該控件,
查看Location.X, Location.Y的值,就知道它在哪個位置了。
至于代碼是屬于哪個控件的事件處理的,在窗體設計器中頂部可見。
當編輯Label1的代碼時,頂部會顯示控件名稱和事件名稱。
本來可以用簡單的dos命令的,但是影射成功與否返回不理想,建議用API,見下面
Module?LocalNetConnect'模塊,直接復制即可
Public?Declare?Function?WNetAddConnection2?Lib?"mpr.dll"?Alias?"WNetAddConnection2A"?(ByRef?lpNetResource?As?NETRESOURCE,?ByVal?lpPassword?As?String,?ByVal?lpUserName?As?String,?ByVal?dwFlags?As?Integer)?As?Integer
Public?Declare?Function?WNetCancelConnection2?Lib?"mpr.dll"?Alias?"WNetCancelConnection2A"?(ByVal?lpName?As?String,?ByVal?dwFlags?As?Integer,?ByVal?fForce?As?Integer)?As?Integer
Public?Structure?NETRESOURCE
Dim?dwScope?As?Integer
Dim?dwType?As?Integer
Dim?dwDisplayType?As?Integer
Dim?dwUsage?As?Integer
Dim?lpLocalName?As?String
Dim?lpRemoteName?As?String
Dim?lpComment?As?String
Dim?lpProvider?As?String
End?Structure
Public?Function?netconnect(ByVal?localDrive?As?String,?ByVal?sharePath?As?String,?ByVal?userName?As?String,?ByVal?UserPassword?As?String)?As?Boolean
Dim?NetR?As?New?NETRESOURCE
Dim?ErrInfo?As?Integer
NetR.dwScope?=?2
NetR.dwType?=?1
NetR.dwDisplayType?=?3
NetR.dwUsage?=?1
'設置驅(qū)動器
NetR.lpLocalName?=?localDrive
'設置遠程端口名字
NetR.lpRemoteName?=?sharePath
'設置連接
ErrInfo?=?WNetAddConnection2(NetR,?UserPassword,?userName,?1)
If?ErrInfo?=?0?Then
Return?True
Else
Return?False
End?If
End?Function
Public?Function?netdisconnect(ByVal?localDrive?As?String)?As?Boolean
Dim?ErrInfo?As?Integer
ErrInfo?=?WNetCancelConnection2(localDrive,?1,?False)
If?ErrInfo?=?0?Then
Return?True
Else
Return?False
End?If
End?Function
End?Module
‘調(diào)用
Private?Sub?Button1_Click(ByVal?sender?As?System.Object,?ByVal?e?As?System.EventArgs)?Handles?Button1.Click
'這里是映射調(diào)用,administrator為用戶名,根據(jù)實際用戶名
’如果將“Z:”設置為空就不會網(wǎng)絡盤映射但是已經(jīng)和172.26.120.47聯(lián)機了(返回真時成立)。
If?netconnect("Z:",?"\\172.26.120.47\c$",?"administrator",?"局域網(wǎng)電腦實際密碼")?=?True?Then
MsgBox("success")
Else
MsgBox("Faile")
End?If
End?Sub
Private?Sub?Button2_Click(ByVal?sender?As?System.Object,?ByVal?e?As?System.EventArgs)?Handles?Button2.Click'這里是取消映射
If?netdisconnect("Z:")?=?True?Then
MsgBox("success")
Else
MsgBox("Faile")
End?If
End?Sub
文件鏡像功能吧, 監(jiān)控文件的變化然后實時同步就行了 .. 好像是叫那個filewatcher類,可以做