方法一:你可以用一个public变量记录文件的路径;
方法二:
Dim str As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\abc.mdb;Persist Security Info=False"Dim mc = System.Text.RegularExpressions.Regex.Matches(str,"(?<=Data Source=).+?(?=;)")msgbox(mc(0).value)