Home Forums WinForms controls Xceed Grid for WinForms Problems re-entering a GridNumericTextBox

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #14898 |

    Hi,

    I have a column of type string in a grid, and using the code below I’m trying to get one of the cells in that column to only accept numeric input.

    What happens is that the first time I edit the input everything works fine. However the cell won’t go into edit mode a second time. Ideas anyone?

    Dim columnKey As New Column(“Key”, GetType(String))
    Dim columnValue As New Column(“Value”, GetType(String))

    GridControl1.Columns.Add(columnKey)
    GridControl1.Columns.Add(columnValue)

    Dim rowWidth As Xceed.Grid.DataRow = GridControl1.DataRows.AddNew()
    rowWidth.Cells(“Key”).Value = “A”
    Dim NumEditor As Xceed.Grid.Editors.GridNumericTextBox = New Xceed.Grid.Editors.GridNumericTextBox
    rowWidth.Cells(“Value”).CellEditor = NumEditor
    rowWidth.EndEdit()

    Imported from legacy forums. Posted by thesandman (had 1785 views)

    User (Old forums)
    Member
    Post count: 23064

    Well what you could do is still use a NumericEditor on the cell. You could derive from the NumericEditor class as demonstrated here : http://doc.xceedsoft.com/products/gridNET/doc/sources/deriving_from_the_celleditormanager_class.htm

    Override getControlValueCore and setControlValueCore, you could then call a ToString() on the numeric value returned to that it is still a “string”.

    I don’t have a sample that does this specifically however, this should work.

    Imported from legacy forums. Posted by Matt (had 2938 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.