user2189832
user2189832

Reputation: 1

janus gridex index after drag column

I have a problem with a Janus GridEX in vb6.

I implemented the method _keydown in order to make searches on a db, so when I press a particular key I make a search with changes depending on the column that is selected.

To do that I obtain the index of the column in which I'm by using the method .col of the gridex, all works correctly, but if I drag a column in the gridex changing its position the .col value changes, but the strange thing is that if I try to access the value of the column with the .value(intColumn) method, it seems that the col index does not change.

For example if I make a given search when I'm in the col number 4, and I drag a column with index higher than 4 in a position with index less than 4 I get the following situation, .col give me value 5, but if I call .value(5) I don't get the value that before was in the 4 column, i get it if I call .value(4).

Therefore I don't understand how the index changes when there is a drag of a column. Anyone has some ideas?

Upvotes: 0

Views: 1163

Answers (1)

Adel Khayata
Adel Khayata

Reputation: 2836

I use Janus library & I always use the Key property instead of the hardcoded col numbers.

Here is one example:

Decimal name = String.Empty;

if (grdEx.CurrentColumn.Key == "Name")
    name = Convert.ToString(grdEx.GetValue("Name"));

This will always prevent errors like the one in your case.

Upvotes: 0

Related Questions