lidds Posted September 13, 2005 Posted September 13, 2005 Joe Mamma, Thanks for the example of how to use a Global Class it has been a really help and I am in the process of getting rid of all the Global Variables :p . I however do need a bit of help of how to write a public property for an arraylist. Below is the code that I am using but it is giving me an error 'Object reference not set to an instance of an object' Public Class ICASData Private Shared mInstance As ICASData Private mPermissions As ArrayList Private Sub New() End Sub Public Property Permissions() As ArrayList Get Return mPermissions End Get Set(ByVal Value As ArrayList) mPermissions = Value End Set End Property Shared ReadOnly Property Instance() As ICASData Get If mInstance Is Nothing Then mInstance = New ICASData() Return mInstance End Get End Property End Class And this is the code that I am using to try and set the arraylist property. ICASData.Instance.Permissions.Add("RW") But it's not working, any help from you guys would be of great help. Cheers Simon Quote
*Experts* DiverDan Posted September 13, 2005 *Experts* Posted September 13, 2005 At a quick glance you might want to replace Private mPermissions As ArrayList with Private mPermissions As New ArrayList And Public Property Permissions() As ArrayList Get Return mPermissions End Get Set(ByVal Value As ArrayList) mPermissions.AddRange(Value) End Set End Property I haven't tested this but I think it should work fine. Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
lidds Posted September 13, 2005 Posted September 13, 2005 Thanks a lot, it was driving me crazy. Just trying to get to grips with this at the moment seems a very clean way to work. Don't suppose as you are online you could maybe help me with another question that I posted that I could do with some guidance on ;) http://www.xtremedotnettalk.com/showthread.php?t=94042 Once again thanks for the help. Simon Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.