• Aask
  • Newbie Topic Starter
GetString returns the list of selected cells



GetArray returns a data structure that has two longs, Row & Column; the structure is TSelItemInfo.

Why doesn't GetArray simply return a 2-dimensional array whose first dimension is the number of cells (ROWS) and two Columns? (Row,Col)

Another question: how would you define


Dim arr() As TSelItemInfo

when using late binding?
1: Do you need to know the number of selected items? SelItems.Count contains this value.

2: Try to use Variant.
  • Aask
  • Newbie Topic Starter
- I am familiar with Count (in the context of the number of selections). However, I did not find an Item property wherewith to loop up to Count.

1. If I am using late binding, (as opposed to adding a reference to iGrid), how can I create an instance of TSelItemInfo? I am thinking of something like:

set xyx = CreateObject(?.?) (as an alternative to Dim arr() As TSelItemInfo).

where I am struggling to find what ?.? would be.

As far as I know, Variant will cope with different data types but NOT with data structures like TSelItemInfo which is a data structure containing Row & Col.

2. If the argument to SelItems.GetArray is optional (as shown in the help file) why is it looking for an argument; SelItems.GetString has the same signature as SelItems.GetArray but it does NOT insist on an argument.

PS: With my client, I can use late binding only.
Very interesting - SelItems does not have the GetString method. Perhaps, it's the time to ask you: what is your development environment?

As for using Variants, the following code works in VB6:

Dim i As Long
Dim arr As Variant

arr = iGrid1.SelItems.GetArray

For i = 1 To UBound(arr)
   Debug.Print arr(i).Row; arr(i).Col
  • Aask
  • Newbie Topic Starter

Very interesting - SelItems does not have the GetString method.

Interesting indeed! It does - see attached picture showing the intellisense dropdown.


Click to View Image36 View(s)

GetString is NOT in the help file but is in the Grid object.
  • Aask
  • Newbie Topic Starter
There is a mix-up regarding the GetArray and GetString method of the SelItems object. Both GetArray and GetString take identical and optional arguments.


GetArray method:
Result@Array_Custom_TSelItemInfo lMinRow@Long lMaxRow@Long lMinCol@Long lMaxCol@Long ← WI 'GetArray' [lMinRow@Long [lMaxRow@Long [lMinCol@Long [lMaxCol@Long]]]]
Returns the array of the currently selected items.


GetString method:
Result@String lMinRow@Long lMaxRow@Long lMinCol@Long lMaxCol@Long ← WI 'GetString' [lMinRow@Long [lMaxRow@Long [lMinCol@Long [lMaxCol@Long]]]]
Returns the string that represents the currently selected items.

The GetString method is not documented in the help file.

The GetString method is expected to return a 4 element numeric array. It doesn’t. In fact, it returns the selected cells (Row, Column) and the 4 element numeric array.


(2,1);(4,1);(4,2);(6,1);(6,3) 2 6 1 3

This is the result that GetArray is supposed to return.

GetArray simply does not work for me – I’ve tried many combinations of arguments.

The help file example for GetArray shows it returning Custom_TSelItemInfo – there is no indication that the other 4 numeric elements are returned.


1. The GetString method needs to be included in the help file.

2. GetString returns a 5 element result - the result appears to be the result that GetArray should be returning.

3. Both GetString and GetArray take optional arguments yet GetArray is demanding an argument.

I believe some corrections/enhancements are required in order to align the published public interface of the grid with the interface that is actually exposed.
OMG! I completely forgot that we added the SelItems.GetString() method in one of the latest builds of iGrid. It's hard to keep all changes in the brains when you are working with thousands of customers :)

The help file is really missing the corresponding topic, but we'll definitely fix that in the next public update of the control.

As for the method output, I re-checked it. In my tests it always returns a string according to the template



Can you send us a sample demonstrating your problem? It seems you are using iGrid in a VBA-based environment. I asked you about your dev env but have not received any answer.
  • Aask
  • Newbie Topic Starter
No problem; I know from personal experience how easy it is to forget/overlook the change history of large projects.

I look forward to the updated help file. Also, since GetArray will work with a variant array - as you've posted - you may want to include that example in the help file too.

I still have some issues with GetArray/GetString, the least of these is to understand why both are necessary. I'll explain further and provide further step by step explanation/illustration of the issues: I'll send this to your email address.

May I suggest some enhancements for the future?

1. A method, say, SaveSession, which will save the content only of the grid as XML to a file; the name of the file will be the argument to the method. Of course this will require a complementary method, say, RestoreSession which will read the file back into the grid.

Of course if you want to introduce further flexibility, you could cater for JSON (and CSV) documents as well as XML ones. The format can be another argument to the methods.

2. A method, say, SaveSessionStyles, which will save the objects e.g. combo boxes etc., formatting, and cosmetic aspects of the current grid. RestoreSessionStyles will be the complementary function.

My reasons for this suggestion are:

1. XML, CSV, and JSON documents are ubiquitous.

2. Saving the whole session and being able to restore it promotes rapid presentation of the grid in a user interface. It should be possible to restore the contents only, or the contents and styles in any order. I am thinking of contexts where the workflow requires Resume i.e. continue from where I left off.

3. A supplementary advantage will be that you can, within reason, load any XML (or JSON) into the grid.

4. These methods will enable users to acquire and transfer data with ease. When an XML file is read into the grid, users can use, say, ReadIntoArray to acquire the data in their own environment. Saving to a file in a generic format such as XML also makes it easy for users to transfer data from their environment to any other application that can read XML.
Originally Posted by: Aask 

I still have some issues with GetArray/GetString, the least of these is to understand why both are necessary.

I do not remember exactly, but we implemented the GetString method for a customer who could not use GetArray in his development environment (obviously, it was not a VB/VBA-based dev env). A string returned by GetString was the only way to provide information about the selected items.


Thank you for your suggestion regarding the Save/Restore methods. Let's continue this discussion in email correspondence as this thread is dedicated to the SelItems property.