Click here to Skip to main content
15,908,834 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: program application to connect HSAjet Mini Key ink jet printer Pin
Member 1119728818-Oct-16 21:43
Member 1119728818-Oct-16 21:43 
GeneralRe: program application to connect HSAjet Mini Key ink jet printer Pin
Richard MacCutchan18-Oct-16 23:38
mveRichard MacCutchan18-Oct-16 23:38 
QuestionA way to get Next node or previous node in a treeview according to its position on the tree Pin
desanti14-Oct-16 13:30
desanti14-Oct-16 13:30 
AnswerRe: A way to get Next node or previous node in a treeview according to its position on the tree Pin
Richard MacCutchan14-Oct-16 21:10
mveRichard MacCutchan14-Oct-16 21:10 
GeneralRe: A way to get Next node or previous node in a treeview according to its position on the tree Pin
desanti15-Oct-16 16:49
desanti15-Oct-16 16:49 
GeneralRe: A way to get Next node or previous node in a treeview according to its position on the tree Pin
Richard MacCutchan15-Oct-16 21:33
mveRichard MacCutchan15-Oct-16 21:33 
AnswerRe: A way to get Next node or previous node in a treeview according to its position on the tree Pin
Eddy Vluggen15-Oct-16 0:31
professionalEddy Vluggen15-Oct-16 0:31 
AnswerRe: A way to get Next node or previous node in a treeview according to its position on the tree Pin
Richard Deeming17-Oct-16 1:49
mveRichard Deeming17-Oct-16 1:49 
There's nothing built-in, but it's fairly simple to write your own:
VB.NET
Public Shared Function FindNextNode(ByVal node As TreeNode) As TreeNode
    If node Is Nothing Then Throw New ArgumentNullException("node")
    
    ' If the node has any children, return the first child:
    If node.GetNodeCount(False) <> 0 Then
        Return node.Nodes(0)
    End If
    
    ' Otherwise, return the next node of the nearest ancestor which has one:
    While node IsNot Nothing
        Dim nextNode As TreeNode = node.NextNode
        If nextNode IsNot Nothing Then Return nextNode
        node = node.Parent
    End While
    
    ' If we get here, we're at the end of the tree:
    Return Nothing
End Function

Public Shared Function FindPreviousNode(ByVal node As TreeNode) As TreeNode
    If node Is Nothing Then Throw New ArgumentNullException("node")
    
    Dim result As TreeNode = node.PrevNode
    If result Is Nothing Then
        ' No previous sibling; move to the parent node:
        result = node.Parent
    Else
        ' Find the last descendant of the previous sibling:
        Dim childCount As Integer = result.GetChildCount(False)
        While childCount <> 0
            result = result.Nodes(childCount - 1)
            childCount = result.GetChildCount(False)
        End While
    End If
    
    Return result
End Function




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


QuestionAccess and post data via Web Service using VB6 Pin
Member 127792476-Oct-16 0:34
Member 127792476-Oct-16 0:34 
AnswerRe: Access and post data via Web Service using VB6 Pin
Richard MacCutchan6-Oct-16 0:50
mveRichard MacCutchan6-Oct-16 0:50 
AnswerRe: Access and post data via Web Service using VB6 Pin
Dave Kreskowiak6-Oct-16 2:38
mveDave Kreskowiak6-Oct-16 2:38 
QuestionConnections with My SQL Pin
Hermawan265-Oct-16 23:31
Hermawan265-Oct-16 23:31 
SuggestionRe: Connections with My SQL Pin
Richard MacCutchan6-Oct-16 0:51
mveRichard MacCutchan6-Oct-16 0:51 
GeneralRe: Connections with My SQL Pin
Hermawan266-Oct-16 16:45
Hermawan266-Oct-16 16:45 
AnswerRe: Connections with My SQL Pin
Mycroft Holmes6-Oct-16 12:44
professionalMycroft Holmes6-Oct-16 12:44 
GeneralRe: Connections with My SQL Pin
Hermawan266-Oct-16 16:46
Hermawan266-Oct-16 16:46 
QuestionHow to get a file in subfolder in UWP? Pin
jeffery c5-Oct-16 0:30
jeffery c5-Oct-16 0:30 
QuestionFinding the path to the pictures Pin
JR21227-Sep-16 0:29
JR21227-Sep-16 0:29 
AnswerRe: Finding the path to the pictures Pin
Dave Kreskowiak27-Sep-16 3:56
mveDave Kreskowiak27-Sep-16 3:56 
GeneralRe: Finding the path to the pictures Pin
Eddy Vluggen27-Sep-16 4:27
professionalEddy Vluggen27-Sep-16 4:27 
GeneralRe: Finding the path to the pictures Pin
JR21227-Sep-16 4:46
JR21227-Sep-16 4:46 
GeneralRe: Finding the path to the pictures Pin
Eddy Vluggen27-Sep-16 6:27
professionalEddy Vluggen27-Sep-16 6:27 
AnswerRe: Finding the path to the pictures Pin
Richard Deeming27-Sep-16 5:38
mveRichard Deeming27-Sep-16 5:38 
GeneralRe: Finding the path to the pictures Pin
Dave Kreskowiak27-Sep-16 5:50
mveDave Kreskowiak27-Sep-16 5:50 
GeneralRe: Finding the path to the pictures Pin
Richard Deeming27-Sep-16 6:02
mveRichard Deeming27-Sep-16 6:02 

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.