Solved

VB RichText Box

Posted on 1998-09-14
4
348 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
[X]
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
  • 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vb6 connector to SQL Server 2 42
Export Data to Different .csv Files 27 131
Problem to line 23 79
Excel Macro: Correct Macro that creates tabs for each "AccountSku" 4 40
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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 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…

740 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