469,922 Members | 2,148 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,922 developers. It's quick & easy.

I am trying to split continuous data from multiple sources and put them in richtextbo


I am using visual basic on visual studio and I am getting data from the GPS and Encoder and Radar through Arduino, and I want to split them in the visual studio form, in richtextboxes, knowing the full code is on the visual studio and I am not using the Arduino software.

Initially, I made a code for the split but of course, it's 100% right, it's only separate on lines.

this is the code :

Public Class Form1

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

Dim rown As Integer
Dim coulmnn As Integer

coulmnn = 1
rown = RichTextBox1.Lines.Length
Label1.Text = rown

Dim finaldata(rown, coulmnn) As String

Dim x As String = RichTextBox1.Text

Dim splittedarray() = x.Split(vbLf)

For i = 1 To rown

finaldata(i, 1) = splittedarray(i - 1)

Next i

End Sub
End Class

The data come like this :

Data from Encoder :

Data from GPS :

Location : 51.059494.24.882541 Data/Time: 11/26/2020 22:22:35.00
Location : 51.059494.24.882541 Data/Time: 11/26/2020 22:22:36.00
Location : 51.059494.24.882541 Data/Time: 11/26/2020 22:22:37.00
Location : 51.059494.24.882541 Data/Time: 11/26/2020 22:22:38.00

Thanks and regards,
Dec 14 '20 #1
3 2194
213 128KB
I can give you a couple of links for VB6 but you might be using a .net application. You might have to adjust it as Microsoft has diligently worked at destroying Visual Basic after they saw how extremely valuable VB6 became and they were unable to control how far programmers went with it. Thus, .net with its many conflicting versions and with its always JIT (wide open code for everyone to see all of the time). And thus, starting with VS2010 the Microsoft compiler forcefully injecting back doors into the executables. But, here is some help with VB6 and with parsing the rtf format in case that helps you.



Years ago, I found it easy to read the rtf (file or string) and parse that directly.

For example:
English: Hello WORLD!
Japanese: こんにちは世界!

In rtf format is:
Expand|Select|Wrap|Line Numbers
  1. {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}{\f1\froman\fprq1\fcharset128 MS PGothic;}}
  2. {\*\generator Msftedit;}\viewkind4\uc1\pard\f0\fs20 English: Hello WORLD!\par
  3. Japanese: \f1\'82\'b1\'82\'f1\'82\'c9\'82\'bf\'82\'cd\'90\'a2\'8a\'45\'81\'49\f0\par
  4. \par
  5. }
Look at VB6 sites for parsing rtf code. With practice it became very easy for me.

A process to see the rtf:
Open Word Pad and paste in the following:
English: Hello WORLD!
Japanese: こんにちは世界!
Then save the file as EnglishToJapanese.rtf (in the rtf format option)

Close Word Pad.

Change the file extension from .rtf to .txt .

Open the file with NotePad (different from wordpad).

See the text in the rtf code.
I use C++11 these days, but the previous might help you.

Thanks for asking.
Dec 14 '20 #2
213 128KB
Here [X] is an rtf example. I should have given you this link earlier.

Save the file locally.
Change the extension to ".rtf" .

Open the file with notepad to see the actual formatting of the .rtf .

Open the file with wordpad to see the file in .rtf .

I hope this helps.
Dec 17 '20 #3
267 256MB
Is your intention to create as many new rich text boxes as the number of split data and write the split data to each ?

Expand|Select|Wrap|Line Numbers
  1.         For i = 1 To rown
  3.             finaldata(i, 1) = splittedarray(i - 1)
  5.             Dim rtb As New RichTextBox
  6.             With rtb
  7.                 .Left = 500
  8.                 .Top = 31 * i
  9.                 .Width = 400
  10.                 .Height = 30
  11.                 .Text = finaldata(i, 1)
  12.             End With
  13.             Me.Controls.Add(rtb)
  15.         Next i
Dec 18 '20 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by David Elliott | last post: by
reply views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.