Hi,
You never added a UID property. The read only property HoldData
returns the UID.
Ken
---------------
"Brian" <n@a.com> wrote in message
news:ab******************************@news.teranew s.com:
I define my class as below, I don't need to override the "new(text as
string)" method as it not inherited, but I don't know why.
-------------------
Public Class TreeNode2
Inherits System.Windows.Forms.TreeNode
Private m_UID As Integer
ReadOnly Property HoldData()
Get
Return m_UID
End Get
End Property
Sub New(ByVal txt As String, ByVal UID As Integer)
MyBase.New(txt)
m_UID = UID
End Sub
End Class
-------------------
I create an instance of the new class in the code below
--------------------
Dim parentnode As TreeNode2
parentnode = New TreeNode2("1st Tree Node ", -1)
----------------
I then respond to the event of the treeview, it is at this point I have a
problem as VB.Net says UID is not a member of TreeNode2
-----------------
Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e
As
System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
Dim mynode As TreeNode2
mynode = CType(e.Node, TreeNode2)
MessageBox.Show(mynode.UID)
End Sub
--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (
http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 262.10.6 - Release Date: 5/28/2004