Converting V6 Format to VB.net

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello
I am trying to convert the following statement to from Vb6 to VB.Net but
with no luck. Can anyone tell me what would be an equivalent of this format
statement would be in vb.net?


For indx = 0 To SendLen - 1
tmpStr = tmpStr & Format(Hex(SendBuff(indx)), "00") & " "
Next indx


Thanks so much

AL
 
Al said:
Hello
I am trying to convert the following statement to from Vb6 to VB.Net but
with no luck. Can anyone tell me what would be an equivalent of this format
statement would be in vb.net?


For indx = 0 To SendLen - 1
tmpStr = tmpStr & Format(Hex(SendBuff(indx)), "00") & " "
Next indx


In .Net the StringBuilder class is more performant, requiring fewer objects
to be created, when concatenating text:

Dim data As Integer() = New Integer() {5, 10, 15, 20, 25, 30}
Dim msg As New System.Text.StringBuilder
Dim text As String

For idx As Integer = 0 To data.GetUpperBound(0)
text = Hex(data(idx)).PadLeft(2, "0"c)
msg.Append(text)
msg.Append(" ")
Next

MsgBox(msg.ToString)




HTH
LFS
 
Back
Top