Click here to Skip to main content
15,891,204 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Generalarray bitmaps? :confused: Pin
p_dog_200715-Jan-04 9:53
p_dog_200715-Jan-04 9:53 
GeneralRe: array bitmaps? :confused: Pin
Jblake0016-Jan-04 3:01
Jblake0016-Jan-04 3:01 
GeneralRe: array bitmaps? :confused: Pin
p_dog_200716-Jan-04 12:18
p_dog_200716-Jan-04 12:18 
QuestionHow to fill the fields of IE's web page from within VB or C++ ? Pin
John Thomas15-Jan-04 6:07
John Thomas15-Jan-04 6:07 
QuestionHow to get rid of mouse right click popup Pin
MadCow15-Jan-04 3:22
MadCow15-Jan-04 3:22 
AnswerRe: How to get rid of mouse right click popup Pin
Niels Penneman15-Jan-04 7:36
Niels Penneman15-Jan-04 7:36 
GeneralRe: How to get rid of mouse right click popup Pin
MadCow16-Jan-04 15:53
MadCow16-Jan-04 15:53 
GeneralTreeview adds nodes to itself without apparent cause Pin
cnurse14-Jan-04 21:51
cnurse14-Jan-04 21:51 
Hi,

I am using a treeview and I saw a neat way of adding your own type of nodes using a class derived from TreeNode. My class is the same as a tree node but it has a key property I can use to index into collections of other stuff

class TreeNodeCommand
Inherits TreeNode

Public Key as string

End Class

In order to make my code slick I then wrote two conversion functions, so that any nodes returned from treeview are converted to TreeNodeCommand...

Private Function CurrentNode() As TreeNodeCommand
Return ToTreeNodeCommand(tvwCommands.SelectedNode)
End Function

Private Function RootNode() As TreeNodeCommand
Return ToTreeNodeCommand(tvwCommands.Nodes.Item(0))
End Function

' Convert tree node item to tree node command item
Private Function ToTreeNodeCommand(ByRef prItem As TreeNode) As TreeNodeCommand
Return CType(prItem, TreeNodeCommand)
End Function


OK, thats the background. I have a treeview that refers to TreeNodeCommands rather than TreeNodes.

I have drag and drop support on this treeview, but I dont want the user to be able to drop a particular thing on the Root node. So in my dragover code I select the node in the treeview under the mouse and using my CurrentNode and RootNode properties I check to see if they are the same node....

If Not CurrentNode Is RootNode Then
e.Effect = DragDropEffects.Copy
End If

...but guess what. Every single time the IF statement executes, I get another node added to the tree, which is effectively a CLONE of the root node.

If I do this, which is perfectly acceptable, but not as slick to read then all is well...

If Not tvwCommands.SelectedNode Is tvwCommands.Nodes(0) Then
e.Effect = DragDropEffects.Copy
End If

You will have had to see this to believe it. No where does any single line of code get executed that does a ...Nodes.Add. Yet, new nodes do appear.

I can work around this, but I would be really interested to see if for some reason you think the Clone method of the root node is being invoked by the type conversion, or by some other means. I think that's what it is. The interesting thing is I override the Clone method in my derived class and it doesn't get called at any time.

So, I am lost in la la land with this one people. Any thoughts or similar experiences would be appreciated. Perhaps I am missing something due to my lack of .NET experience.

Apologies for the lengthy post.




Nursey
GeneralMore info...another case which causes the tree to duplicate Pin
cnurse14-Jan-04 23:24
cnurse14-Jan-04 23:24 
GeneralRe: More info...another case which causes the tree to duplicate Pin
Guillermo Rivero15-Jan-04 1:59
Guillermo Rivero15-Jan-04 1:59 
GeneralRe: More info...another case which causes the tree to duplicate Pin
cnurse15-Jan-04 2:26
cnurse15-Jan-04 2:26 
Generalformatting date to a RTF Pin
R. Thomas14-Jan-04 15:57
R. Thomas14-Jan-04 15:57 
GeneralRe: formatting date to a RTF Pin
Niels Penneman16-Jan-04 6:14
Niels Penneman16-Jan-04 6:14 
GeneralConverting a bitmap to an array of pixels Pin
elchip14-Jan-04 11:06
elchip14-Jan-04 11:06 
GeneralWM_NOTIFY Reports incorrect values Pin
Knight Lore14-Jan-04 7:46
Knight Lore14-Jan-04 7:46 
GeneralRe: WM_NOTIFY Reports incorrect values Pin
Niels Penneman14-Jan-04 9:39
Niels Penneman14-Jan-04 9:39 
GeneralRe: WM_NOTIFY Reports incorrect values Pin
Knight Lore15-Jan-04 4:07
Knight Lore15-Jan-04 4:07 
GeneralRe: WM_NOTIFY Reports incorrect values Pin
Niels Penneman15-Jan-04 6:19
Niels Penneman15-Jan-04 6:19 
GeneralRe: WM_NOTIFY Reports incorrect values Pin
Niels Penneman15-Jan-04 6:20
Niels Penneman15-Jan-04 6:20 
GeneralCopy files from source to Destination Pin
len_ems13-Jan-04 20:19
len_ems13-Jan-04 20:19 
GeneralRe: Copy files from source to Destination Pin
Corinna John13-Jan-04 23:54
Corinna John13-Jan-04 23:54 
GeneralGet active machines Pin
radhika8113-Jan-04 18:52
radhika8113-Jan-04 18:52 
GeneralRe: Get active machines Pin
Dave Kreskowiak14-Jan-04 4:08
mveDave Kreskowiak14-Jan-04 4:08 
GeneralRe: Get active machines Pin
Anonymous16-Jan-04 18:06
Anonymous16-Jan-04 18:06 
GeneralRe: Get active machines Pin
Dave Kreskowiak17-Jan-04 3:55
mveDave Kreskowiak17-Jan-04 3:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.