Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
3555
Copy data from clipboard to grid.
posted
I get the following error when I try to copy data from the clipboard to
grid. Cannot Convert System.String to System.Decimal. How can I get around
this? The datatype for the columns is decimal. Here is my code... I tried
Convert.ToDecimal(System.Windows.Forms.Clipboard.GetText()); but that did
not work.

private void ultraGrid1_KeyDown(object sender, KeyEventArgs e)

{

switch (e.KeyCode)

{

case Keys.C :

if (e.Control == true)

{

if (ultraGrid1.Selected.Cells.Count == 1)

{

System.Windows.Forms.Clipboard.SetText(this.ultraGrid1.Selected.Cells[0].Value.ToString());

}


}

break;

case Keys.V:

if (e.Control == true)

{

if (ultraGrid1.Selected.Cells.Count > 0)

{

foreach (Infragistics.Win.UltraWinGrid.UltraGridCell cell in
this.ultraGrid1.Selected.Cells)

{

cell.Value = System.Windows.Forms.Clipboard.GetText();

}

}

}

break;


}

}