I want to be able to know what is the Paragraph Number for the Cursor’s actual mocation in a TextArea.
Understand that I do not know where the Cursor is nor x,y…
I indexed the text paragraphs of a TextArea, and want to get Paragraph X or Paragraph Y, etc.; the one where the cursor is.
I searched in the LR, but failed to find a clue.
something like this?
Label1.Text = TextArea1.Text.Middle(TextArea1.SelectionStart,1)
me thought about getting the § there
You’ll have to watch for multiple EndOfLines after a paragraph, though. You might want to replace multiple endoflines with a single one before doing the countfields.
“Officially”, I know how many EndOfLines I have.
What I do not - yet - tested is if each “EndOfLine” (understand Paragraph) have one or more characters.
I indexed the TextArea contents, so asking for UBound gaves me that value, but…
This is preliminary work, I do not know yet how the Lego bricks will be set (?) Look, I cannot write (yet) what I want !
Back home, I will test the advice(s) and decide what to do.
I want to be able to get the text from the paragraph were the Cursor resides. So, an empty paragraph is tested later. But I have to implement the code to be sure.
Maybe split the text from the start to selection start over endofline and then iterate through the array trimming the lines and looking for changes between empty and non empty lines. This would catch invisible spaces on “empty” lines.
Split(Source,EndOfLine)assigned to an array (real code n a different computer).
The start idea was there is no empty lne. But I do not started to wrote the lines, so…
For testings purposes, I will take a text file from my hard disk (the first file I will reach)…
I was searching
But, with differents words (CursorLocation or InsertionPosition for examples)…
Now I can select a whole paragraph with a single Tab…