'Dim MyPath As String = "\\192.168.0.201\Document\模板\"
Dim MyPath As String = "D:\bin\Document\模板\"
Dim MyDirectories As String()
=================================================================
'选定模板类型。
Private Sub 模_类型_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 模_类型.SelectedIndexChanged
ReadTemplateSort()
End Sub
=================================================================
'读取所选定的 模板目录列表 到 ListBox1_模板目录列表 控件。
Private Sub ReadTemplateSort()
Dim MySubPath As String = MyPath + Me.模_类型.SelectedItem + "\"
MyDirectories = Directory.GetDirectories(MySubPath)
Dim MySubDirectories As String
For Each MySubDirectories In MyDirectories
Me.ListBox1_模板目录列表.Items.Add(MySubDirectories.Remove(0, MySubPath.Length))
Next
End Sub
=====================================================
Imports System.Management
Imports System.Net
Imports System.IO
Private Sub ConnectServer(ByVal IPAdress As String, ByVal UserName As String, ByVal Password As String)
'通过IP,用户,密码连接服务器。
Try
Dim coption As New ConnectionOptions
coption.Username = CStr(Trim(UserName))
coption.Password = CStr(Trim(Password))
Dim scope As ManagementScope
scope = New ManagementScope("\\" & CStr(Trim(IPAdress)) & "\root\cimv2", coption)
scope.Connect()
If scope.IsConnected = True Then
MsgBox("连接成功!", MsgBoxStyle.OKOnly, "提示")
End If
'Catch ex As Exception
' MsgBox("无法连接服务器。", MsgBoxStyle.OKOnly, "提示")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub