vb.net获取函数名 vb获取excel单元格值

vb.net从文件路径中获取文件名获取方法,参考实例如下:
'获取路径名各部分:如: c:\dir1001\aaa.txt
'获取路径路径c:\dir1001\
Public Function GetFileName(FilePathFileName As String) As String'获取文件名aaa.txt
On Error Resume Next
Dim i As Integer, J As Integer
iLen(FilePathFileName)
JInStrRev(FilePathFileName, "\")
GetFileNameMid(FilePathFileName, J + 1, i)
End Function
''获取路径路径c:\dir1001\
Public Function GetFilePath(FilePathFileName As String) As String '获取路径路径c:\dir1001\
On Error Resume Next
Dim J As Integer
JInStrRev(FilePathFileName, "\")
GetFilePathMid(FilePathFileName, 1, J)
End Function
'获取文件名但不包括扩展名aaa
Public Function GetFileNameNoExt(FilePathFileName As String) As String'获取文件名但不包括扩展名aaa
On Error Resume Next
Dim i As Integer, J As Integer, k As Integer
iLen(FilePathFileName)
JInStrRev(FilePathFileName, "\")
kInStrRev(FilePathFileName, ".")
If k0 Then
GetFileNameNoExtMid(FilePathFileName, J + 1, i - J)
Else
GetFileNameNoExtMid(FilePathFileName, J + 1, k - J - 1)
End If
End Function
'===== '获取扩展名.txt
Public Function GetFileExtName(FilePathFileName As String) As String'获取扩展名.txt
On Error Resume Next
Dim i As Integer, J As Integer
iLen(FilePathFileName)
JInStrRev(FilePathFileName, ".")
If J0 Then
GetFileExtName".txt"
Else
GetFileExtNameMid(FilePathFileName, J, i)
End If
End Function
vb.net如何读取其他人的网页,并且可以自动判断编码的哪种?求函数'******************************
'函数名:GetHtml
'作用:读取其他网站页面内容
'参数:Url是要读取的网站地址
'返回值:读取后的网站内容
'******************************
Function GetHtml(ByVal Url As String, ByVal bm As String) As String
Dim httpReq As System.Net.HttpWebRequest
Dim httpResp As System.Net.HttpWebResponse
Dim httpURL As New System.Uri(Url)
Dim respHTML As String = ""
httpReq = CType(WebRequest.Create(httpURL), HttpWebRequest)
httpReq.Method = "GET"
Try
httpResp = CType(httpReq.GetResponse(), HttpWebResponse)
httpReq.KeepAlive = False ' 获取或设置一个值 , 该值指示是否与 Internet资源建立持久连接 。
Dim reader As StreamReader = New StreamReader(httpResp.GetResponseStream, System.Text.Encoding.GetEncoding(bm))
respHTML = reader.ReadToEnd() 'respHTML就是网页源代码
Catch
respHTML = "zhongduan"
End Try
Return respHTML
End Function
VB.NET的函数 , 将值赋给函数名与 return 返回值得区别有返回值vb.net获取函数名:函数执行结束vb.net获取函数名 , 必须将执行的某个结果数据返回给调用者
没有返回值:函数执行结束,没有返回任何结果给调用者
vb 还是vb.net这两种都有 。不是说vb不带返回值而.net带返回值
VB.NET存取注册表项的几个函数1、首先引用命名空间vb.net获取函数名:using Microsoft.Win32;
2、几个基本主键:
Registry.ClassesRoot;对应于HKEY_CLASSES_ROOT主键
Registry.CurrentUser;对应于HKEY_CURRENT_USER主键
Registry.LocalMachine;对应于 HKEY_LOCAL_MACHINE主键
Registry.User;对应于 HKEY_USER主键
Registry.CurrentConfig;对应于HEKY_CURRENT_CONFIG主键
Registry.DynDa; 对应于HKEY_DYN_DATA主键
Registry.PerformanceData; 对应于HKEY_PERFORMANCE_DATA主键
【vb.net获取函数名 vb获取excel单元格值】3、返回或创建一个注册表键
Dim Key1 As Microsoft.Win32.RegistryKey
Key1 = My.Computer.Registry.CurrentUser'返回当前用户键

推荐阅读