Windows Develop Bookmark and Share   
 index > Windows Forms General > Complicated Custom DataGridView Question with example.
 

Complicated Custom DataGridView Question with example.

Hello, this questions is extremely complicated to ask and perhaps even more difficult to solve. The only way to answer this question is to provide an example. I will try to be as concise as possible.

I have created a custom control called a KeyMapBox. The purpose of this control is to allow a user to input a 'code' (or acronym) while displaying to the user the associated meaning to this code

(ie: there may be two codes CBV and DLN where CBV relates to Combivent and DLN to Dilantin.) If a user was inputing a code and made a mistake the keymap box would turn red and at this point the user can press the DOWN arrow to get a list of codes and their associated meanings that closest match what they've entered.

The control is not the problem, in fact it works how I want it to work. The problem lies within putting this control into a datagridview custom column.

When a user selects a value in the keymapbox the value changes however when the user switches to a nother cell in the grid this value is ignored and the old value replaces the new, that is, there is no way to change the value.

Below is an example that you can copy paste and execute. If you create a new Windows Form project and replace the code in the Form1.cs by copy pasting (and comment out the Form1.Designer code) you can run an example.

When you run the example you will see two DataGridView's the top one is what the user would be working with and the keyMapBox column is the Drug Code column (looks liek a combo box).

As a side note (for those of you who want to test this out) there is an error occuring with this particular test that is not allowing the Keymapbox to behave correctly. So just use the mouse to click on the (comboBox drop down) then select a value to change from the original and watch the value switch back to the old one.

CommanderKeen  Tuesday, September 15, 2009 6:31 PM
Due to the code size restricitons on the forums I will provide a link to my website to download the example:
http://curtisstodgell.com/content/keymapbox-datacolumn-example
CommanderKeen  Tuesday, September 15, 2009 7:12 PM
Bump
CommanderKeen  Wednesday, September 23, 2009 10:26 PM

You can use google to search for other answers

Custom Search

More Threads

• Data Alignment in Listview Control
• Form.ShowDialog
• Stripped TreeView
• disabling SHIFT + DELETE
• events from xml...
• printdialog not showing
• Trying to capture the HelpEvent from the WebBrowser.ShowPrintPreviewDialog
• Mouse Click outside of a Windows Form not responding
• Try catch End Try block inside a loop in vb.net
• TopLevel Focus