vb.net - Get Current Cell Value in EditingControlShowing -
what i'm trying is, if type "red" cell, cell's backcolor changes red , if type "blue" cell, cell's backcolor changes blue. problem i'm getting is, if type "blue", "blu" recorded mystring, textchanged event records cell value before change, cell's backcolor never changes color result. hoping might have idea on how current cell value after textchange. current code below (this example). ideas or appreciated, thanks.
private sub datagridview1_currentcelldirtystatechanged(sender object, e eventargs) handles datagridview1.currentcelldirtystatechanged me.datagridview1.commitedit(datagridviewdataerrorcontexts.commit) end sub dim editingcontrol datagridviewtextboxeditingcontrol private sub datagridview1_editingcontrolshowing(sender object, e datagridvieweditingcontrolshowingeventargs) handles datagridview1.editingcontrolshowing editingcontrol = e.control addhandler editingcontrol.textchanged, addressof editingcontrol_textchanged end sub private sub editingcontrol_textchanged(sender object, e eventargs) mystring = me.datagridview1.currentcell.value if mystring = "red" editingcontrol.backcolor = color.red elseif mystring = "blue" editingcontrol.backcolor = color.blue else editingcontrol.backcolor = color.white end if end sub
Comments
Post a Comment