Jay1b Posted March 3, 2005 Posted March 3, 2005 Could someone please tell me what i am doing wrong? I've based this from an example from a book - which doesnt work either! Good book huh? Dim cls2Killed As ClsProcess cls2Killed = New ClsProcess cls2Killed.blah = 10 MsgBox(cls2Killed.blah) Public Class ClsProcess Inherits EventArgs Private testint As Integer Public Property blah() As Integer Get blah = testint MsgBox("retrieving a value " + Str(blah)) End Get Set(ByVal Value As Integer) MsgBox("setting a value " + Str(blah)) End Set End Property End Class Thanks Quote
Administrators PlausiblyDamp Posted March 3, 2005 Administrators Posted March 3, 2005 Set(ByVal Value As Integer) testint=value MsgBox("setting a value " + Str(blah)) End Set Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Jay1b Posted March 4, 2005 Author Posted March 4, 2005 (edited) Thanks PD, i double checked the book after i read this and it is definately wrong. Its not just an oversight on my behalf. When running the program i get the following msgboxes: *retrieving a value 10 *setting a value 10 *set *retrieving a value 10 *10 When debugging i've added a watch for cls2Killed.blah and i get "error: cannot obtain value". Firstly why does it 'get' the value before setting it? Secondly is the error displayed in the watch and error for the watch, or an actual error in my program? It displays the 10 value correctly. Private testint As Integer Public Property blah() As Integer Get blah = testint MsgBox("in blah and retrieving a value" + Str(blah)) End Get Set(ByVal Value As Integer) testint = Value MsgBox("in blah and setting a value" + Str(blah)) End Set End Property Dim cls2Killed As ClsProcess cls2Killed = New ClsProcess(5, 6) cls2Killed.blah = 10 MsgBox("set") MsgBox(cls2Killed.blah) Thanks PS i think i need another book :eek: Edited March 4, 2005 by Jay1b 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.