views:

93

answers:

0

Hi I have a datagridview table and I want to disable drag and drop in some specific situations.

Example:

I have 4 columns named A,B,C,D. I divide them in to 2 groups: A,B and C,D (for a user they look like 4 normal columns). Now when the user drags a column A or B, he can only drop it before C. When he drags C or D, he can only drop it after B.

I tried to detect the DisplayIndex values in the ColumnDisplayIndexChanged but this event is fired multiple times and I got an exeption that DisplayIndex is being changed or sth and I can't change it at that moment.

Is there any way to do sth like that?
Thanks in advance.