can i declare array with one element?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2010
09:14 PM
03-11-2010
09:14 PM
can i declare array with one element?
Hi !
I have declared array, and now i want to add one item in array, and when i execute, i get en error!
can't i declare array with 1 length,? i mean can't i have array with one element?
For example
I have declared array, and now i want to add one item in array, and when i execute, i get en error!
can't i declare array with 1 length,? i mean can't i have array with one element?
For example
MyStruct = DLL.DefineType("TemplateCodesStruct", VT_VARIANT, "Value")
Set TemplateCode = DLL.New("TemplateCodesStruct",1)
TemplateCode.Item(0).Value = "AEdit"
And the error was "Objecy doesn't support this property or method TemplateCode.Item:"
5 REPLIES 5
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2010
12:20 AM
03-15-2010
12:20 AM
Heeyy.. 😞 can u help me?
Thanks in advance..
Thanks in advance..
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2010
02:13 AM
03-16-2010
02:13 AM
Count The number of the elements to be created. By default, it is 1, which means that you are creating one instance of the specified type. If Count is greater than 1, it means that you are creating an array of elements of the specified type. -- copied from TestComplete help
Try this,
...
MyStruct = DLL.DefineType("TemplateCodesStruct", VT_VARIANT, "Value")
Set TemplateCode = DLL.New("TemplateCodesStruct",2)
TemplateCode.Item(0).Value = "AEdit"
I think the count should be 2, which means array ... hope this hels.
Nancy
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2010
06:19 PM
03-16-2010
06:19 PM
sooo, can't i have an array with one element?? i always must have min 2 elements in array....?
MyStruct = DLL.DefineType("TemplateCodesStruct", VT_VARIANT, "Value")
Set TemplateCode = DLL.New("TemplateCodesStruct",1)
MyStruct = DLL.DefineType("TemplateCodesStruct", VT_VARIANT, "Value")
Set TemplateCode = DLL.New("TemplateCodesStruct",1)
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2010
06:04 AM
03-18-2010
06:04 AM
It sounds Yes. Well if your array only has one item, why do you need an array? Or you can create an 2 items array, but only put one item in, leave item(1) as null, TestComplete will still pass the test...
Nancy
Nancy
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2010
12:03 AM
03-19-2010
12:03 AM
Hi Elya,
As far as we understand, an array consisting of one object of a specific type and an object of this type do not differ, and your code should work fine with a single object even if it is expecting an array. If this is not your case, could you please post here the signature or declaration of the function you are working with so we can recreate this situation here?
--
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
