Code:
Private Sub GetData_Click()
Grid1.Rows = 10 'filas de la tabla
Grid1.Clear
Grid1.TextMatrix(0, 0) = "Parámetro" 'Títulos de las columnas
Grid1.TextMatrix(0, 1) = "Valor actual"
Grid1.Visible = True 'Que se muestre la tabla de resultados sólo cuando se haga click en el botón
Dim sString As String
Dim fileNum As Integer
fileNum = FreeFile
Open App.Path & "\mensajeAPI.txt" For Input As #fileNum 'Abre el fichero donde están los datos
Dim y As Integer
Do While Not EOF(fileNum) 'Leer fichero
Line Input #fileNum, sString
If Mid(sString, 4, 4) = "mac-" Then
y = InStrRev(sString, "=")
Grid1.TextMatrix(1, 0) = Mid(sString, 4, y - 4)
Grid1.TextMatrix(1, 1) = Mid(sString, y + 1)
End If
If Mid(sString, 4, 4) = "rx-r" Then
y = InStrRev(sString, "=")
Grid1.TextMatrix(2, 0) = Mid(sString, 4, y - 4)
Grid1.TextMatrix(2, 1) = Mid(sString, y + 1)
End If
If Mid(sString, 4, 4) = "tx-r" Then
y = InStrRev(sString, "=")
Grid1.TextMatrix(3, 0) = Mid(sString, 4, y - 4)
Grid1.TextMatrix(3, 1) = Mid(sString, y + 1)
End If
If Mid(sString, 4, 4) = "pack" Then
y = InStrRev(sString, "=")
Grid1.TextMatrix(4, 0) = Mid(sString, 4, y - 4)
Grid1.TextMatrix(4, 1) = Mid(sString, y + 1)
End If
If Mid(sString, 4, 4) = "upti" Then
y = InStrRev(sString, "=")
Grid1.TextMatrix(5, 0) = Mid(sString, 4, y - 4)
Grid1.TextMatrix(5, 1) = Mid(sString, y + 1)
End If
If Mid(sString, 4, 4) = "last" Then
y = InStrRev(sString, "=")
Grid1.TextMatrix(6, 0) = Mid(sString, 4, y - 4)
Grid1.TextMatrix(6, 1) = Mid(sString, y + 1)
End If
If Mid(sString, 4, 16) = "signal-strength=" Then
y = InStrRev(sString, "=")
Grid1.TextMatrix(7, 0) = Mid(sString, 4, y - 4)
Grid1.TextMatrix(7, 1) = Mid(sString, y + 1)
End If
If Mid(sString, 4, 8) = "signal-t" Then
y = InStrRev(sString, "=")
Grid1.TextMatrix(8, 0) = Mid(sString, 4, y - 4)
Grid1.TextMatrix(8, 1) = Mid(sString, y + 1)
End If
If Mid(sString, 4, 16) = "signal-strength-" Then
y = InStrRev(sString, "=")
Grid1.TextMatrix(9, 0) = Mid(sString, 4, y - 4)
Grid1.TextMatrix(9, 1) = Mid(sString, y + 1)
End If
Loop
Grid1.ColAlignment(1) = 2
Close fileNum
End Sub
Private Sub Form_Load()
Grid1.Cols = 2
Grid1.ColWidth(0) = 3000
Grid1.ColWidth(1) = 3000
End Sub
Thank you!