On May 4, 2006, at 10:30 AM, Emile Schwarz wrote:

 Dim TriangleOne As Variant // To use the automatic type conversion
 Dim TriOne(5)   As Integer // 6 entries array
 // Fills the Variant with a "String variable"
 TriangleOne = "5,5,25,5,15,25"
 // Fills the Array
 // Test #1 (fails)
 TriOne = TriangleOne.Split(",")

TriangleOne is a variant. Split extends a String, thus won't work.

 // Test #2 (fails too)
 TriOne = Split(TriangleOne,",")
I've got the same error message:

"Error: Type mismatch error. Expected Int32(), but got String()."

Split takes a String, and returhs a String array. The fact that TriangleOne is a variant, split doesn't know about. The compiler will convert the variant to a string before calling Split, and Split will continue to do it's job with the string.

BTW: Why dim the array using 6 cells ? Also, why filling it starting at cell 1 ?
[at last, I am asking myself why it works...]

Unfortunately, there are some inconsistencies where some things are 0- based, and others are 1-based.

[after a simple test]: I can't believe it... it does not works when I dim the array at 5 and fill the cells from 0 to 5... Incredible!

That's an interesting idea -- if Draw/FillPolygon gets an odd-sized array, perhaps it should start at 0 instead of 1. If you'd like to see that, please do file a feature request.

HTH,
Jon


--
Jonathan Johnson
[EMAIL PROTECTED]
REAL Software, Inc.


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to