0

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?

Adel Khayata
  • 2,717
  • 10
  • 28
  • 46
  • I solved! I used a JSColumn object in which I store the column at the position in which I am, then I get the column index by calling the method .index of the JSColumn. `Set tmpJsCol = jsgdLisMov.Columns.ItemByPosition(jsgdLisMov.col) intCol = tmpJsCol.Index` – user2189832 Apr 10 '13 at 09:10

1 Answers1

0

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.

Adel Khayata
  • 2,717
  • 10
  • 28
  • 46