Home > DeveloperSection > Forums > Text box with long text get two rows
Jeet Verma
Jeet Verma

Total Post:110

Points:776
Posted on    March-26-2014 3:56 AM

 C# C# 
Ratings:


 1 Reply(s)
 748  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.



Pravesh Singh

Total Post:411

Points:2881
Posted on    March-26-2014 4:30 AM

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;

        }

    }


Don't want to miss updates? Please click the below button!

Follow MindStick