Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

VB RichText Box

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

808 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