Search code examples
vb.netdevexpressdevexpress-windows-ui

DevExpress GridView Select & replace item in Cell?


Is there a way like in Windows Textbox control to replace the selected text with in a cell? I know that an entire cell can be done with SetRowCellValue, but what about just a selection?

Thanks


Solution

  • When a user edits a cell, an editor is used. So, you can get it using the GridView.ActiveEditor property:

    if (gridView1.ActiveEditor == null || !(gridView1.ActiveEditor is TextEdit))
        return;
    TextEdit editor = (TextEdit)gridView1.ActiveEditor;
    editor.SelectedText = DateTime.Now.ToString();