如何从多行文本框获取行到单个文本框?
How To Get Line From Multiline Textbox to single textbox?
THAT'S PREVIEW APP
如何获取最后一行,例如:DD D5 08 0C 0C 20 08 00 90 00 从多行文本框到单行文本框,
我想当我单击按钮 1 时,我只得到最后一个结果 (DD D5 08 0C 0C 20 08 00 90 00) 到单个文本框
亲爱的请帮帮我
我的代码是这样的:
Public Sub displayOut(ByVal errorType As Integer, ByVal returnValue As Integer, ByVal printText As String)
TextBoxLogs.Text += printText & vbCrLf
TextBoxLogs.SelectionStart = TextBoxLogs.Text.Length
TextBoxLogs.ScrollToCaret()
TextBoxLogs.Refresh()
End Sub
Private Sub ButtonGetCardInfo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetCardInfo.Click
displayOut(1, 0, "Card unique serial number")
'CardCommands.getCardUniqueSerialNumber()
If Not Common.isSuccessful Then
Return
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Common.clearBuffers()
Common.sendBuff(0) = &H80 'CLA
Common.sendBuff(1) = &H14 'INS
Common.sendBuff(2) = &H0 'P1
Common.sendBuff(3) = &H0 'P2
Common.sendBuff(4) = &H8 'LE
Common.sendLen = 5
Common.recvLen = 255
Common.returnCode = Common.sendApdu(2)
ErrorCodes.interpretReturnStatus()
End Sub
使用多行文本框的 Lines() 属性...
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
SingleTextBox.Text = TextBoxLogs.Lines(TextBoxLogs.Lines.GetUpperBound(0))
End Sub
如果您可能在 TextBox 的末尾有不确定数量的空行,则遍历 Lines() 数组 向后 直到找到第一个非空行:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
For i As Integer = TextBoxLogs.Lines.GetUpperBound(0) To 0 Step -1
If TextBoxLogs.Lines(i).Trim <> "" Then
SingleTextBox.Text = TextBoxLogs.Lines(i)
Exit For
End If
Next
End Sub
THAT'S PREVIEW APP
如何获取最后一行,例如:DD D5 08 0C 0C 20 08 00 90 00 从多行文本框到单行文本框,
我想当我单击按钮 1 时,我只得到最后一个结果 (DD D5 08 0C 0C 20 08 00 90 00) 到单个文本框
亲爱的请帮帮我
我的代码是这样的:
Public Sub displayOut(ByVal errorType As Integer, ByVal returnValue As Integer, ByVal printText As String)
TextBoxLogs.Text += printText & vbCrLf
TextBoxLogs.SelectionStart = TextBoxLogs.Text.Length
TextBoxLogs.ScrollToCaret()
TextBoxLogs.Refresh()
End Sub
Private Sub ButtonGetCardInfo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetCardInfo.Click
displayOut(1, 0, "Card unique serial number")
'CardCommands.getCardUniqueSerialNumber()
If Not Common.isSuccessful Then
Return
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Common.clearBuffers()
Common.sendBuff(0) = &H80 'CLA
Common.sendBuff(1) = &H14 'INS
Common.sendBuff(2) = &H0 'P1
Common.sendBuff(3) = &H0 'P2
Common.sendBuff(4) = &H8 'LE
Common.sendLen = 5
Common.recvLen = 255
Common.returnCode = Common.sendApdu(2)
ErrorCodes.interpretReturnStatus()
End Sub
使用多行文本框的 Lines() 属性...
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
SingleTextBox.Text = TextBoxLogs.Lines(TextBoxLogs.Lines.GetUpperBound(0))
End Sub
如果您可能在 TextBox 的末尾有不确定数量的空行,则遍历 Lines() 数组 向后 直到找到第一个非空行:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
For i As Integer = TextBoxLogs.Lines.GetUpperBound(0) To 0 Step -1
If TextBoxLogs.Lines(i).Trim <> "" Then
SingleTextBox.Text = TextBoxLogs.Lines(i)
Exit For
End If
Next
End Sub