Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Arrays

Status
Not open for further replies.

lpatnaik

Programmer
Jul 11, 2002
53
I have created an object in my vb project which is named TaskObject.
This TaskObject has a property Resources which should contain an array of strings.
I need to set an array to strings to this property and also retrives the same at some point during the app.
The following is muy code :
but i am not able to get the array from the object neither set it.

IN TASKOBJECT.CLS - ->

Private m_resources As Variant
Public Property Get Resources() As Variant
Resources = m_resources
End Property

Public Property Let Resources(ByRef vNewValue As Variant)
m_resources = Resources
End Property


IN MY FORM:
dim arrTasks(2) as TaskObject
For j = 1 To objTask.Resources.Count - 1
arrResource(j) = objTask.Resources.Item(j)
Next
arrTasks(1).Resources = arrResource

--arrTasks is an array of taskobjects.

Can anyone help out
 


as a start try
Code:
For j = 1 To objTask.Resources.Count - 1
    arrResource(j) = objTask.Resources(j)
instead of
Code:
For j = 1 To ubound(objTask.Resources) - 1
    arrResource(j) = objTask.Resources.Item(j)
You will need to change the for loop as well from
the item property is not valid for the Resources property of the TaskObject class

The count and item properties are implemented by a collection, which is different to an array.

Take Care

Matt

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top