adding childnode in non expandable nodes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Friends

I am working with treeview control and its working fine with except when I am trying to add child node in non - expandable node and i call the method newnode.ensurevisible. it does not add to the node.

Also if i see the quick watch of child node, I can see the nullreferenceexception and it does either raise the exception

please help me guys if you guys come accros the same problem

thank
Manish Jai
(e-mail address removed)
(e-mail address removed)
 
* "=?Utf-8?B?TWFuaXNoIEphaW4=?= said:
I am working with treeview control and its working fine with except
when I am trying to add child node in non - expandable node and i call
the method newnode.ensurevisible. it does not add to the node.

"Post your code."
 
following function I am calling and sending reference of my tree view

Public Function createChild(ByRef xTree As TreeView, ByRef xNode As TreeNode, ByRef strCode As String, ByRef strCodeType As String, ByRef strName As String, ByRef strTag As String, Optional ByRef bMakeVisible As Boolean = False) As TreeNod
Tr
dim pNode as new treenod
pNode.Text = strNam
Dim strKey As Strin
strKey = strCode & strCodeType & ":" & _treetag.Key(
xNode.Nodes.Add(pNode
pNode.EnsureVisible(
createChild = pNod
Catch ex As Exceptio
logError(ex, "createChild"
createChild = Nothin
Throw e
End Tr
End Functio

----- Herfried K. Wagner [MVP] wrote: ----

* "=?Utf-8?B?TWFuaXNoIEphaW4=?= said:
I am working with treeview control and its working fine with excep
when I am trying to add child node in non - expandable node and i cal
the method newnode.ensurevisible. it does not add to the node.

"Post your code.
 
* "=?Utf-8?B?TWFuaXNoIEphaW4=?= said:
Public Function createChild(ByRef xTree As TreeView, ByRef xNode As TreeNode, ByRef strCode As String, ByRef strCodeType As String, ByRef strName As String, ByRef strTag As String, Optional ByRef bMakeVisible As Boolean = False) As TreeNode

Why do you pass everything 'ByRef'?
Try
dim pNode as new treenode
pNode.Text = strName
Dim strKey As String
strKey = strCode & strCodeType & ":" & _treetag.Key()
xNode.Nodes.Add(pNode)
pNode.EnsureVisible()


The code should work...
 
The Code working fine in normal case i.e when I load the data from database. but the node I am adding a dummy node and thats the time it is failing. I am not sure what could be wrong in this.

basically it fails when I call the ensurevisible method

Please help

thank
manish jain
 
Back
Top