文件镜像功能吧, 监控文件的变化然后实时同步就行了 .. 好像是叫那个filewatcher类,可以做
成都创新互联公司坚持“要么做到,要么别承诺”的工作理念,服务领域包括:成都网站设计、成都网站建设、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的保靖网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!
public Color col(string colorName)
{
Type colorType = typeof(Color);
PropertyInfo info = colorType.GetProperty(colorName, BindingFlags.Public | BindingFlags.Static);
if (infos == null)
{
//throw Exception
}
return(Color)info.GetValue(null, null);
}
是这个意思么?输入“Red”, 返回Color.Red 区分大小写
vb.net是完全面向对象的语言,支持面向对象的四个基本属性:抽象,继承,多态,封装,但vb是面向过程的语言,它只支持部分面向对象的内容像多态,接口等。从 VB 7.0 之后的版本俗称 VB.NET,来源于微软的.NET战略,到现在为止有三个版本
VB 7.0 即VB 2002,对应.NET Framework 1.0的版本
VB 7.1 即VB 2003,对应.NET Framework 1.1的版本
VB 8.0 即VB 2005,对应.NET Framework 2.0的版本
除了语法和使用习惯的继承,VB 6.0之前的版本和VB 7.0之后的版本完全没有联系,几乎没有相同之处,两种不同体系的语言
本来可以用简单的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
'设置驱动器
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
‘调用
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'这里是映射调用,administrator为用户名,根据实际用户名
’如果将“Z:”设置为空就不会网络盘映射但是已经和172.26.120.47联机了(返回真时成立)。
If netconnect("Z:", "\\172.26.120.47\c$", "administrator", "局域网电脑实际密码") = 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