Advertise with us

Text box with long text get two rows

Posted by  Jeet Verma
 1490  View(s)
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. 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