Hello Luke,
for example the code for making the childnodes:
Private Sub update_mrkparlist(ByRef prp_date_id As Integer, ByRef
mrk_num As String)
Dim paritem As ListViewEx.ListViewItem
Dim prp_par_num() As Short = Nothing
Dim prp_par_kom() As String = Nothing
Dim prp_par_val() As Single = Nothing
Dim prp_par_fmt() As String = Nothing
Dim prp_par_txt() As String = Nothing
Dim idx As Short
Dim par_node As TreeViewEx.TreeNode
Dim mkey As String = ""
Dim parTxt As String = ""
ACTION_SEND = AC_LOAD
siz_size = MAX_REC_SIZE
rec_size = 0
retval = ole2eva.w_ustmmprl(rec_size, siz_size, prp_date_id,
mrk_num, prp_par_num, prp_par_kom, prp_par_val, prp_par_fmt, prp_par_txt,
zugriff_user, ACTION_SEND, ACTION_RET)
If rec_size = MAX_REC_SIZE Then
meassage(fm_evastamm.DefInstance.lv_text.GetText("T_message_maxsize"))
End If
If ts_main.SelectedTab.Name = "MPLST" Then
bring_Listbox("MPLST", Im_EVA)
lv_main.Columns.Clear()
lv_main.Columns.Add(fm_evastamm.DefInstance.lv_text.GetText("T_Parameter"),
70, HorizontalAlignment.Left)
lv_main.Columns.Add(fm_evastamm.DefInstance.lv_text.GetText("T_Kommentar"),
150, HorizontalAlignment.Left)
lv_main.Columns.Add(fm_evastamm.DefInstance.lv_text.GetText("T_Wert"), 50,
HorizontalAlignment.Left)
lv_main.Columns.Add(fm_evastamm.DefInstance.lv_text.GetText("T_Format"), 50,
HorizontalAlignment.Left)
lv_main.Columns.Add(fm_evastamm.DefInstance.lv_text.GetText("T_ParameterText"), 300, HorizontalAlignment.Left)
End If
While tv_main.SelectedNode.GetNodeCount(False) > 0
tv_main.Nodes.Remove((tv_main.SelectedNode.FirstNode))
End While
lv_main.Items.Clear()
tv_main.ImageList = Im_EVA
parTxt = fm_evastamm.DefInstance.lv_text.GetText("T_Parameter") & ": "
For idx = 0 To rec_size - 1
mkey = "MP" & prp_date_id & KEYSEP & mrk_num & KEYSEP &
prp_par_num(idx)
paritem = New ListViewEx.ListViewItem(mkey, 11,
CStr(prp_par_num(idx)))
paritem.Text = CStr(prp_par_num(idx))
paritem.SubItems.Add(prp_par_kom(idx))
paritem.SubItems.Add(to_string(prp_par_fmt(idx),
prp_par_val(idx), idx + 1))
paritem.SubItems.Add(prp_par_fmt(idx))
paritem.SubItems.Add(prp_par_txt(idx))
lv_main.Items.Add(paritem)
par_node = New TreeViewEx.TreeNode(mkey, 11, parTxt &
prp_par_num(idx))
par_node.Tag = prp_par_num
tv_main.SelectedNode.Nodes.Add(par_node)
Next idx
End Sub
this is the code to making the selected node bold and the selected node
befor to normal fond
Public Sub tv_main_AfterSelect(ByVal sender As Object, ByVal e As
System.Windows.Forms.TreeViewEventArgs) Handles tv_main.AfterSelect
Dim fnt As Font
Dim fnt_bold As Font
akt_node = tv_main.SelectedNode
fnt = akt_node.NodeFont
fnt_bold = New Font(fnt, FontStyle.Bold)
akt_node.NodeFont = fnt
If Not (akt_node_befor Is Nothing) Then akt_node_befor.NodeFont = fnt
akt_node.NodeFont = fnt_bold
akt_node_befor = akt_node
End Sub
and hear you see the code for my extended treeview with key inside
Public Class TreeNode
Inherits System.Windows.Forms.TreeNode
Implements IDictionaryEnumerator
Private nodeEntry As DictionaryEntry
Private enumerator As IEnumerator
Public Sub New()
enumerator = MyBase.Nodes.GetEnumerator()
End Sub
Public Sub New(ByVal Key As String)
enumerator = MyBase.Nodes.GetEnumerator()
nodeEntry.Key = Key
End Sub
Public Sub New(ByVal Key As String, ByVal ImageIndex As Short, ByVal
Text As String)
enumerator = MyBase.Nodes.GetEnumerator()
nodeEntry.Key = Key
MyBase.Text = Text
MyBase.ImageIndex = ImageIndex
MyBase.SelectedImageIndex = ImageIndex
MyBase.NodeFont = New Font("Microsoft Sans Serif", 8,
FontStyle.Regular)
End Sub
Public Property NodeKey() As String
Get
Return nodeEntry.Key.ToString()
End Get
Set(ByVal Value As String)
nodeEntry.Key = Value
End Set
End Property
Public Property NodeValue() As Object
Get
Return nodeEntry.Value
End Get
Set(ByVal Value As Object)
nodeEntry.Value = Value
End Set
End Property
Public Overridable Overloads ReadOnly Property Entry() As
DictionaryEntry _
Implements IDictionaryEnumerator.Entry
Get
Return nodeEntry
End Get
End Property
Public Overridable Overloads Function MoveNext() As Boolean _
Implements IDictionaryEnumerator.MoveNext
Dim Success As Boolean
Success = enumerator.MoveNext()
Return Success
End Function
Public Overridable Overloads ReadOnly Property Current() As Object _
Implements IEnumerator.Current
Get
Return enumerator.Current
End Get
End Property
Public Overridable Overloads ReadOnly Property Key() As Object _
Implements IDictionaryEnumerator.Key
Get
Return nodeEntry.Key
End Get
End Property
Public Overridable Overloads ReadOnly Property Value() As Object _
Implements IDictionaryEnumerator.Value
Get
Return nodeEntry.Value
End Get
End Property
Public Overridable Overloads Sub Reset() _
Implements IEnumerator.Reset
enumerator.Reset()
End Sub
End Class
I hobe this will help you to help me.
Best regards
Manfred Loeffler