Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7092505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:19:18+00:00 2026-05-28T08:19:18+00:00

I am a beginner to web application development. I have the code of a

  • 0

I am a beginner to web application development. I have the code of a windows application. Same functionality i have to convert into a web application. I have a text box control. I am loading some text to that text box. I want to find the current cursor position, line number and column number. The code for the windows application is below:

    private void Form1_Load(object sender, EventArgs e)
    {
        textBox1.Text = @"This is a demo for text box control
                      I am trying to find the cursor position ,
                      line no and column no 
                       of the cursor.";         


    }

    private void textBox1_Click(object sender, EventArgs e)
    {
       textBox1.SelectionStart++;
       label2.Text = textBox1.SelectionStart.ToString();
       int i = textBox1.GetLineFromCharIndex(textBox1.SelectionStart);
       label3.Text = i.ToString();
       int j =textBox1.SelectionStart - textBox1. GetFirstCharIndexFromLine(i);
       label4.Text = j.ToString();
    }

    private void textBox1_KeyDown(object sender, KeyEventArgs e)
    {
        if ((e.KeyCode == Keys.Up) || (e.KeyCode == Keys.Right) || 
            (e.KeyCode == Keys.Left) || (e.KeyCode == Keys.Down))
        {
            textBox1.SelectionStart++;
            label2.Text = textBox1.SelectionStart.ToString();
            int i = textBox1.GetLineFromCharIndex(textBox1.SelectionStart);
            label3.Text = i.ToString();
            int j = textBox1.SelectionStart - 
                    textBox1.GetFirstCharIndexFromLine(i);
            label4.Text = j.ToString();
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:19:19+00:00Added an answer on May 28, 2026 at 8:19 am

    as the accepted answer in this post, you have to use javascript to get the SelectionStart and SelectionEnd in your clinet side. then, post the result (may be using a hidden input value) to the server with the reset of data:

    How to get selected text from textbox control with javascript

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a beginner to web application development. I am loading some text to
I'm a beginner coding a Java web application. I used to code Ruby On
I am doing a project of web application. I am still a beginner and
We're developing a data heavy modular web application stack with java but have little
I'm still a beginner at web development. It's not my profession. So go easy.
I'm interested in wed development and web 2.0 but I'm a real beginner, so
I have started developing a full-web application by using the ASP .NET MVC 3
I have a Restlet API and a GWT web application in two seperate web
Preface: I'm still a beginner to web development, let alone rails so I'm constantly
I currently have a very simple web application written in Django, and I would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.