A
Abe Frohnman
Hey all,
I have another task I'm trying to find the solution for. I have a text
box that I want to cut and paste text into, from a menu. This is the
code I have so far:
private void menuItem6_Click(object sender, System.EventArgs e)
{
if (textBoxDescription.ContainsFocus)
{
IDataObject dd = Clipboard.GetDataObject();
if (d.GetDataPresent(DataFormats.Text))
textBox1.Text = d.GetData(DataFormats.Text).ToString();
}
}
The problem with this is that it replaces *everything* in the text box
with the contents of the clipboard. What I want it to do is to insert
the text wherever the cursor is at, or whatever text may be highlighted.
Any advice?
AF
I have another task I'm trying to find the solution for. I have a text
box that I want to cut and paste text into, from a menu. This is the
code I have so far:
private void menuItem6_Click(object sender, System.EventArgs e)
{
if (textBoxDescription.ContainsFocus)
{
IDataObject dd = Clipboard.GetDataObject();
if (d.GetDataPresent(DataFormats.Text))
textBox1.Text = d.GetData(DataFormats.Text).ToString();
}
}
The problem with this is that it replaces *everything* in the text box
with the contents of the clipboard. What I want it to do is to insert
the text wherever the cursor is at, or whatever text may be highlighted.
Any advice?
AF