|
-
Oct 5th, 2012, 03:29 AM
#1
Thread Starter
Lively Member
[RESOLVED] DatagridView Cell Editing Control Value
I am using a DGV control to get data from the user.
1. Editing Control Value
I have multiple columns including combo box and checkbox.
if i need to read the value of the editing control. i.e the value of the cell before the cellediting ends.
i can do it easily from the dgv.currencells.value after the cellediting ends.
But i need to alert the user for entering a wrong value at the moment he enters the data not after finishing his editing.
The same type of value needed from the combox col of the DGV. When he selects an item i have to show error for some of the item and not for all
2.Get Combo Box Column Text Value
I can get the value of the combobox index using the Cell Value.
But i also need the text value of the combo box for manipulation in another column.
Say list of combo box is
1, name1
2,name 2
3,name 3
cell value returns 1,2,3 but i need name1,name 2,name 3 for some manipulation
-
Oct 5th, 2012, 04:27 AM
#2
Re: DatagridView Cell Editing Control Value
1. There seems to be a real run on this type of question lately, here's a thread I posted an answer to recently:
http://www.vbforums.com/showthread.p...put-characters
2. You have bound a list of some sort to the combo box column. That's where the values displayed to the user came from and that's where the cell value came from. Use it to get the text from the ID, just as you would in any other case where you had a list containing IDs and names and you wanted the name that corresponded to a specific ID.
-
Oct 5th, 2012, 07:03 AM
#3
Thread Starter
Lively Member
Re: DatagridView Cell Editing Control Value
Thanks jmcilhinney.
Using that post i solved my problem.
And also fixed the issues u said in the replies of that post for non numerical data & backspace and decimal point.
but i have another doubt raised here.
Is it necessary to declare a row and add it like dday did.
i think not needed since i check each and every keychar of data entered in the dgv_keypress event(as of this Post).
Is thereany advantage of using like so.
And atlast i have not removed handler of dgv_keypresss since u said editingtextbox= nothing will do it. Am i right or need to remove handler
-
Oct 5th, 2012, 10:42 AM
#4
Re: DatagridView Cell Editing Control Value
 Originally Posted by vpm_sampath
Is it necessary to declare a row and add it like dday did.
i think not needed since i check each and every keychar of data entered in the dgv_keypress event(as of this Post).
Is thereany advantage of using like so.
I think dday9 may have misunderstood the question.
 Originally Posted by vpm_sampath
And atlast i have not removed handler of dgv_keypresss since u said editingtextbox= nothing will do it. Am i right or need to remove handler
There are two ways to attach an event handler to the editing control: you can use an AddHandler statement or you can assign it to a field declared WithEvents. You must also detach the event handler when the editing control is removed from the grid. If you used AddHandler then you must use RemoveHandler. If you assigned the control to a WithEvents variable then you simply assign Nothing to that variable.
-
Oct 8th, 2012, 11:33 PM
#5
Thread Starter
Lively Member
Re: DatagridView Cell Editing Control Value
ok so i add an removehandler.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|