Detecting the line within a text box

Posted on 2011-11-01
Last Modified: 2012-06-27
I have an Access database containing a text box object linked to a memo field.  I need to be able to know what line the user is on (within this field).  If they are editing on line 1 - great.  If they are editing line 2 onwards, then it will do something else.

Any suggestions?
Question by:Andy Brown
    LVL 77

    Expert Comment

    How are you defining a 'line'?

    Does the text contain embedded newline characters?  

    Author Comment

    by:Andy Brown
    Hi Pete.

    Line = Verticle position of cursor (for instance line 1 of paragraph 1)

    Yes, I was just thinking about determining the cursors position and was that before a carriage return.
    LVL 47

    Expert Comment

    by:Dale Fye (Access MVP)
    The problem with memo fields and text for that matter is that when viewed in a textbox, they wrap based on the width of the textbox.  You can easily determine what position within the textbox the cursor is located at using the textboxes selStart property.  But determining what "line" that is on in the textbox depends on the font, fontsize, and width of the textbox.
    LVL 8

    Accepted Solution

    Good morning. This page may help you

    I'll try to implement an example and post soon if it works

    Author Closing Comment

    by:Andy Brown
    Great stuff - thanks guys for your help

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
    I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
    With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

    760 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

    7 Experts available now in Live!

    Get 1:1 Help Now