Text box with long text get two rows

Total Post:110

Points:776
C# 
C#
 1175  View(s)
Ratings:
Rate this:

I am using drag and drop from list box to text box and the problem when the item(string) is too long and I drag it to text box I see just the end of the text which was dragged and I see it in 2 rows ,how can I change it that when the long text is dragged to see the start of it if its bigger than the text box.

  1. Post:412

    Points:2888
    Re: Text box with long text get two rows

    Hi Jeet,


    Try this code. This may help you.

        bool isTextDropped= false;
        void textBox_Drop(object sender, DragEventArgs e)
        {
            string tstring;
            tstring = e.Data.GetData(DataFormats.StringFormat).ToString();
            textBox.Text += " " + tstring;
            isTextDropped = true; 
        }      
        void textBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (isTextDropped)
            {
                textBox.SelectionStart = 0;
                textBox.SelectionLength = 0;
                isTextDropped = false;
            }
        }

      Modified On Apr-04-2018 04:40:49 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!