Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Filling Arrays dyanmically
#1
Solved: 11 Years, 3 Months, 3 Weeks ago Rolleyes 
Hi Ankur , First let me thank u for maintaining such a helpful forum.
iam facing a problem with dynamic arrays
i wanna fill a array at run time
here ismy code


Code:
x=JavaWindow("Legal ").JavaList("Role(s)").GetROProperty("items count")

For i=0 to x-1
    rolei=javawindow("Legal ").JavaList("Role(s)").GetItem(i)
    msgbox i
[size=x-large]calypsoarray(i)=rolei[/size]
   msgbox rolei

Next

its giving me a type mismatch error
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
Dear Srinivas,

May i know why you are using x-1 ?

Use i = 0 to x and try...
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
Dear Mr.Sridhar,

If 0 to x is taken, index will be beyond the range by 1 and may show an subscript error? is it not?

Rekha
Reply
#4
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,
I think you forgot to declare array...

Dim calypsoarray(10)

You can choose the size depending upon the requirement..
Reply
#5
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi i need an array dynamic , i dont want to mention the array size
array size should be dynamic by that i can fill the array with n number of elements

thanking you both rekha and somiyasis


Srinu
Reply
#6
Solved: 11 Years, 3 Months, 3 Weeks ago
Dear Srinivas,

Please see the modified code using Dynamic Array...

Code:
Dim calypsoarray()

x=JavaWindow("Legal ").JavaList("Role(s)").GetROProperty("items count")

For i=0 to x-1
             Redim calypsoarray(x)
    rolei=javawindow("Legal ").JavaList("Role(s)").GetItem(i)
    msgbox i
[size=x-large]calypsoarray(i)=rolei[/size]
   msgbox rolei

Next

For Dynamic arrays you have to specify the size by using the Redim statement .


Hope this helps..
Reply
#7
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi somisays

It worked ,the solution is cool

Thank u man
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Filling Array's and then executing test Caleytown 0 1,657 03-11-2009, 03:19 AM
Last Post: Caleytown

Forum Jump:


Users browsing this thread: 6 Guest(s)