Solved

VB RichText Box

Posted on 1998-09-14
4
324 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

762 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

22 Experts available now in Live!

Get 1:1 Help Now