Else
MsgBox "盘符替换失败!"
End If
'删除临时文件
Kill ScriptFile
Kill ScriptLog
End Sub
VB与VB.net各自的优势与区别是什么?vb.net是vb的升级 。
vb.net基于.net框架,是vb发展的必然趋势 。
vb功能非常强大,但是也存在众多的缺点 , 所以微软才会开发vb.net 。
随着时间的发展,vb.net完全取代vb是必然的
VB术语简介
说明下面的代码举例说明了用 Drive 对象来访问驱动器属性:Sub ShowFreeSpace(drvPath) Dim fs, d, s Set fs = CreateObject("Scripting.FileSystemObject") Set d = fs.GetDrive(fs.GetDriveName(drvPath)) s = "Drive "UCase(drvPath)" - " s = sd.VolumeNamevbCrLf s = s"Free Space: "FormatNumber(d.FreeSpace/1024, 0) s = s" Kbytes" MsgBox sEnd Sub.
为什么我在安装VB.NET的时候提示Windows XP SP 2CD光盘插入驱动器IIS需要一个XP系统自带的文件才能安装vb.net驱动器,不记得叫什么名字vb.net驱动器了
如果vb.net驱动器你没有安装盘的话建议它跳出提示框的时候你点击【浏览】
看到那个文件的名字以后去网上搜一下,可能需要的还不止一个文件,你慢慢找吧
另外Vista系统没用过 , 你可以随便找个系统盘试一下,跟盗版正版没关系,都可以装
用VB.NET 怎么编映射网络磁盘本来可以用简单的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
vb.net如何获取电脑中的所有盘符首先使用 System.IO.DriveInfo.GetDrives()获取System.IO.DriveInfovb.net驱动器 , 存入ds()
推荐阅读
- 视频号瑜伽直播,瑜伽教学直播
- 拍摄视频是什么格式,拍视频用什么格式的视频比较好
- 动漫解谜游戏解说文案,动漫解谜游戏解说文案怎么写
- 男装无人直播间,直播男装的话术
- java运行代码出错 java运行时错误
- 安卓开心记事本app,开心日记本
- kafka到hbasescala的简单介绍
- 冰雪大王直播设备,冰雪大王直播设备怎么样
- linux关闭文件的命令 linux取消文件权限