We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Wingrid cell text copying to another cell..but it comes with column names also.

raghu_apps
raghu_apps asked
on
Medium Priority
411 Views
Last Modified: 2012-05-06
HI,
 I am using wingrid, and i diplayed a table information in that grid. In that when ever i selects one cell text..and then trying to copy that information into the another cell, it copied with Cell Column name also. I want only the cell text, not with column name.

e.Layout.Override.CellClickAction = CellClickAction.CellSelect;

i am using this property in Intialize row event.

And i am using Ctrl+c and Ctrl+v keyborad operations for copying and pasting. I am providng code for this..plz check this once..and give me advice.
Plz help on this.
private void FormulaGrid_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                switch (e.KeyCode)
                {
                    case Keys.C:
 
                        if (e.Control == true)
                        {
                            if (FormulaGrid.Selected.Cells.Count == 1)
                            {
                                System.Windows.Forms.Clipboard.SetText(this.FormulaGrid.Selected.Cells[0].Value.ToString());
                            }
                        }
                        break;
 
                    case Keys.V:
 
                        if (e.Control == true)
                        {
                            if (FormulaGrid.Selected.Cells.Count > 0)
                            {
                                foreach (Infragistics.Win.UltraWinGrid.UltraGridCell cell in this.FormulaGrid.Selected.Cells)
                                {
                                    cell.Value = System.Windows.Forms.Clipboard.GetText();
                                }
                            }
                        }
                        break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

Open in new window

Comment
Watch Question

If you are using a DataGridView you can set the property ClipboardCopyMode to:
public enum DataGridViewClipboardCopyMode
{
    Disable,
    EnableWithAutoHeaderText,
    EnableWithoutHeaderText,
    EnableAlwaysIncludeHeaderText
}

 

 

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.