小弟刚学vb.net,请帮忙解释下下面代码,明白了马上给分
#Region "タリーテストにヘッダ転送 "
Private Sub TransHeadBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TransHeadBtn.Click
Dim l_strLog, l_strKind As String
Try
If LogList.SelectedIndex = -1 Then Exit Try
'ログの取得
l_strLog = CStr(LogList.Items(LogList.SelectedIndex))
l_strKind = l_strLog.Substring(24, 2)
'SECNET電文でない場合、終了
If l_strKind <> "S " AndAlso _
l_strKind <> "R " AndAlso _
l_strKind <> "D " AndAlso _
l_strKind <> "T " Then Exit Try
l_strLog = l_strLog.Remove(0, 26)
g_cTestTool.SetTarryHeader(l_strLog.Substring(0, 29))
Catch Err As Exception
'エラーログ
LogWrite(EN_LOGKIND.EN_ERROR, "File :fmLog.vb Method :ClipBoardBtn_Click() Message : " & Err.Message)
End Try
End Sub
#End Region
其中LogList为我的ListBox名字,希望能详细讲解下这段代码是什么功能以及其中部分代码的具体意思,谢谢
[解决办法]
#Region "タリーテストにヘッダ転送 "
Private Sub TransHeadBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TransHeadBtn.Click
Dim l_strLog, l_strKind As String
Try
If LogList.SelectedIndex = -1 Then Exit Try
'ログの取得-取得LOG
l_strLog = CStr(LogList.Items(LogList.SelectedIndex)) ' 读取选中的Item值
l_strKind = l_strLog.Substring(24, 2)
'SECNET電文でない場合、終了-读到不是电文处结束
If l_strKind <> "S " AndAlso _
l_strKind <> "R " AndAlso _
l_strKind <> "D " AndAlso _
l_strKind <> "T " Then Exit Try ' 当Item值的第24、25两位不是 "S "或 "R "或 "D "或 "T "时,退出
l_strLog = l_strLog.Remove(0, 26) ' 删除值的前26位
g_cTestTool.SetTarryHeader(l_strLog.Substring(0, 29)) ' 把值的前29位设为保留头
Catch Err As Exception
'エラーログ-error log
LogWrite(EN_LOGKIND.EN_ERROR, "File :fmLog.vb Method :ClipBoardBtn_Click() Message : " & Err.Message)
End Try
End Sub
#End Region