Home | Articles|Namespace|Interview Questions|Tools|Jobs|Projects|Community
Asp.net Tutorials

»Dotnet Ads
»Message Boards
Message Boards
Dotnet Books

»Member Details
Register
Login
LogOut
Submit Code
Submit Jobs
Submit Projects

»Competition
Community
Winners
Prizes
Write For Us
Members

»Other Resources
Links
Dotnet Resources

Copying clipboard contents in windows forums




//paste
if(Clipboard.GetDataObject().GetDataPresent(DataFormats.Text))
textBox1.Text = Clipboard.GetDataObject().GetData(DataFormats.Text).ToString();
else
textBox1.Text = "The clipboad does not contain any text";

///copy
System.Windows.Forms.Clipboard.SetDataObject(this.ActiveControl.Text);





private void cutToolStripButton_Click(object sender, EventArgs e)
{
Form activeChildForm = this.ActiveMdiChild;

if (activeChildForm != null)
{
TextBox activeTextBox = (TextBox)activeChildForm.ActiveControl;
if (activeTextBox != null)
activeTextBox.Cut();
}
}


Edit the copyToolStripButton_Click method with the following code:


private void copyToolStripButton_Click(object sender, EventArgs e)
{
Form activeChildForm = this.ActiveMdiChild;

if (activeChildForm != null)
{
TextBox activeTextBox = (TextBox)activeChildForm.ActiveControl;
if (activeTextBox != null)
activeTextBox.Copy();
}
}


Edit the pasteToolStripButton_Click method with the following code:
Functions and methods to copy content from a clip boads


private void pasteToolStripButton_Click(object sender, EventArgs e)
{
Form activeChildForm = this.ActiveMdiChild;

if (activeChildForm != null)
{
TextBox activeTextBox = (TextBox)activeChildForm.ActiveControl;
if (activeTextBox != null)
activeTextBox.Paste();
}
}

Have a Question and dont know the answer post it below and get answers in minutes

Due to spam this feature is disabled
To get answers fast , make sure you enter a detailed subject for example: "DataGrid issues need answer" not "DataGrid"

Subject:

Catjegory Name:

Message:



© 2008 dotnetwatch.com -- Privacy policy