自定义类(ASP.NET_VB)

类别:.NET开发 点击:0 评论:0 推荐:

Imports System.Diagnostics

Public Class FSVCommon

    '********************************************************************************************
    '功能  :关闭指定进程
    '参数  :ProcessName:进程名
    '返回值:无
    '上传时间:2005/04/18
    '********************************************************************************************
    Public Shared Function KillProcess(ByVal ProcessName As String)
        Dim pProcess() As Process     '进程序列
        Dim myProcess As Process      '进程名

        pProcess = Process.GetProcessesByName(ProcessName)
        '查找所指定的进程
        For Each myProcess In pProcess
            myProcess.Kill()
        Next
    End Function

    '********************************************************************************************
    '功能  :计算指定字符串的长度(Web)
    '参数  :txtString:指定字符串
    '返回值:长度
    '上传时间:2005/04/18
    '********************************************************************************************
    Private Function GetLength(ByVal txtString As String) As Integer
        Dim textLength As Integer                         '字符串的长度
        textLength = txtString.Length

        Dim i As Integer                                  '循环变量

        For i = 0 To txtString.Length - 1
            '是否为全角字符的判断
            If Not (0 <= Asc(txtString.Substring(i, 1)) _
                And Asc(txtString.Substring(i, 1)) <= 255) And _
                Not (65377 <= Asc(txtString.Substring(i, 1)) _
                And Asc(txtString.Substring(i, 1)) <= 65439) Then
                textLength = textLength + 1
            End If
        Next

        Return textLength
    End Function

End Class

本文地址:http://com.8s8s.com/it/it41221.htm