Link to home
Start Free TrialLog in
Avatar of raghu_apps
raghu_appsFlag for India

asked on

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

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

ASKER CERTIFIED SOLUTION
Avatar of MogalManic
MogalManic
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial