Solved

VB RichText Box

Posted on 1998-09-14
4
327 Views
Last Modified: 2008-02-01
Ok, I have a RichText Box and I want to locate the Current Row and Column.

Row (Line number) is: RT.LineFromChar(RT.SelStart)

What is the Col (Current Character Position)?  It is not RT.SelStart
0
Comment
Question by:MasseyM
  • 2
  • 2
4 Comments
 
LVL 1

Expert Comment

by:MAVERICK
ID: 1434908
Create a loop For..next loop  between the first character and the current character...Using the GetlinefromChar locate the first character in that lines position ... subtract and thats the column value.... Oh and getLinefromchar is the row....

If you need full code... Suggest you increase the points.....But I'll have a look.....


 
0
 
LVL 10

Author Comment

by:MasseyM
ID: 1434909
I want full code... I have the points...

BTW, this must be on-the-fly... I am not sure a loop will work...

0
 
LVL 1

Accepted Solution

by:
MAVERICK earned 50 total points
ID: 1434910
' Declarations

Dim Row As Long
Dim Col As Long
Dim A As Long
Dim B As Long
Dim C As Long
Dim D As Long
'Code for actual position finding
'The Richtext box is the one you want the position for
' Row & column are the co-ordinates
' the text boxes are for testing only


Private Sub RichTextBox1_SelChange()

A = RichTextBox1.SelStart
D = A

B = RichTextBox1.GetLineFromChar(RichTextBox1.SelStart)
If B = 0 Then
Row = 0
Col = A
Else
Do Until RichTextBox1.GetLineFromChar(A - 1) = B - 1
A = A - 1
Loop
Row = RichTextBox1.GetLineFromChar(A + 1)
Col = D - A
End If
Text3.Text = Row
Text4.Text = Col
End Sub

Have fun.....
Jon

0
 
LVL 10

Author Comment

by:MasseyM
ID: 1434911
Maverick!  Marvelous job... Exactly what I wanted...

I have about 200 points waiting to be returned... I will post a question in what ever category you wish as soon as I get my points back...

Just tell me where (I will give another 150).

Thanks!

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now