DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Property Array ?

  1. #1
    Join Date
    Dec 2003
    Location
    Swiss Alps - a strange place for building aeroplanes
    Posts
    55

    Property Array ?

    G'day,

    sorry I'm a bit of a newbie on this .NET stuff and trowling the forum it wasnt immediatly obvious if someone already asked this question

    Visual Studio 2008
    VB.NET

    Is it possible to have a property array ?

    I wish (in this case) to pass and get back a vector of unknow length to and from a class. How can this be acheived?

    Also can the same principale be adopted for an undefined array (type is known eg single, but number and size of dimensions are unknown)

    Thanks

    Rgds

    Eddie

    -------------------
    Private Xarrl() As Single
    Public Property Xarr() As Single
    Get
    Return Xarrl()
    End Get
    Set(ByVal value As Single)
    Xarrl() = value
    End Set
    End Property
    -------------------

  2. #2
    Join Date
    May 2004
    Location
    Duluth MN
    Posts
    353
    I'm not sure what you mean by a vector, but can't you just declare your property type as an Array, or worst case scenario Object. You'll just need to do some validation in the set method to make sure your getting what you expect.

    ...joe

  3. #3
    Join Date
    Dec 2003
    Location
    Swiss Alps - a strange place for building aeroplanes
    Posts
    55
    Hey Joe thanks for your response.

    A vector is nothing more (well to me) than a 1 dimensional array. I'm comming over from VB6 so some of these concepts are - well foreign to me.

    But due to your repsonse I discovered that you CAN create a variable "as Array" and not "() as type"

    I think what I was looking for is

    --------------------------
    Dim Interp As New Interpolation
    Dim X As Array = Array.CreateInstance(GetType(Single), 10)
    For i = X.GetLowerBound(0) To X.GetUpperBound(0)
    X.SetValue(CSng(i * i), i)
    Next
    Interp.Xarray = X

    Public Class Interpolation
    Private Xarrayl As Array
    Public Property Xarray() As Array
    Get
    Return Xarrayl
    End Get
    Set(ByVal value As Array)
    Xarrayl = value
    End Set
    End Property
    End Class

    --------------------------

    I didnt know that you can create an instance

    Hmm more things to learn

    Ho hum

    Thanks again

    Rgds

    Eddie

  4. #4
    Join Date
    May 2004
    Location
    Duluth MN
    Posts
    353
    Quote Originally Posted by Eddie Burdak
    I'm comming over from VB6 so some of these concepts are - well foreign to me.
    I still spend more than half my time in VB5

    ...joe

  5. #5
    Join Date
    Mar 2008
    Posts
    9
    If the array is only going to be dealing with Singles then type is as such.

    You can still use Redim Preserve to expand your array bounds while preserving its existing data. Just like VB6.

Similar Threads

  1. How long before the next version??
    By _CAG in forum .NET
    Replies: 146
    Last Post: 08-12-2002, 10:40 PM
  2. Re: App Object (fixes)
    By Rob Teixeira in forum .NET
    Replies: 129
    Last Post: 06-06-2002, 05:23 AM
  3. App Object
    By Rob Teixeira in forum .NET
    Replies: 15
    Last Post: 05-31-2002, 03:30 PM
  4. RegCreateKey; RegSetValueEx; RegCloseKey API Problems
    By Patrick Kenney in forum VB Classic
    Replies: 4
    Last Post: 08-21-2001, 06:21 PM
  5. RegCreateKey; RegSetValueEx; RegCloseKey API Problems
    By Patrick Kenney in forum VB Classic
    Replies: 0
    Last Post: 08-21-2001, 05:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center