Here is the headers method placed in a module:
Var col As Integer
Var headers() As String
headers = L_headers.ToArray ( "," )
col = 0
For Each h As String In headers
If col <= ListBox.LastColumnIndex Then
ListBox.HeaderAt ( col ) = h
Else
ListBox.HeaderAt ( col ) = ""
End If
col = col + 1
Next
Exception err
Break
End Sub
And then for a dictionnary
Function listeKeys(Extends dico As Dictionary) As string
' Permet d'obtenir une liste des key cle01,cle02... d un dictionnaire
For Each de As DictionaryEntry In dico
If tx_keys = "" Then
tx_keys = tx_keys + de.Key.StringValue
Else
tx_keys = tx_keys + " , " + de.Key.StringValue
End If
Next
Return tx_keys
Yes, it’s a great language feature. By using the Extends modifier, you’re creating what is known as an “Extension Method”.
Because it appears you’re using a number of arguments with it, are you also using the ParamArray modifier to make the number of arguments dynamic? Also a great feature
this variable tx_keys seems outside of the method or you removed this line.
i agree this Extends is very useful.
FromArray is nice no make a csv list, unfortunately not for variant arrays.
Var d As New Dictionary("left" : 0, "top" : 10, "width" : 300, "height" : 300)
Var k() As String
For Each de As DictionaryEntry In d
k.Add de.Key.StringValue
Next
System.DebugLog String.FromArray(k, ",")