Click here to Skip to main content
15,927,699 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionHow to know which control is selected at runtime for runtime generated controls Pin
VB 8.026-Sep-07 1:56
VB 8.026-Sep-07 1:56 
AnswerRe: How to know which control is selected at runtime for runtime generated controls Pin
ESTAN26-Sep-07 12:54
ESTAN26-Sep-07 12:54 
GeneralRe: How to know which control is selected at runtime for runtime generated controls Pin
VB 8.027-Sep-07 3:19
VB 8.027-Sep-07 3:19 
QuestionRe: How to know which control is selected at runtime for runtime generated controls Pin
ESTAN27-Sep-07 5:38
ESTAN27-Sep-07 5:38 
QuestionLoad an OLE Image from Access 03 to Word 03 Pin
Plation26-Sep-07 1:43
Plation26-Sep-07 1:43 
AnswerRe: Load an OLE Image from Access 03 to Word 03 Pin
Plation27-Sep-07 4:10
Plation27-Sep-07 4:10 
QuestionVB.Net: Setting the SelectedNode and SelectedItem font in Treeview and Listview Controls Pin
Mbire26-Sep-07 0:49
Mbire26-Sep-07 0:49 
AnswerRe: VB.Net: Setting the SelectedNode and SelectedItem font in Treeview and Listview Controls Pin
Mbire26-Sep-07 3:22
Mbire26-Sep-07 3:22 
Got it and a bit embarrassed, its amazingly simple.

here are my lines, I used the AfterSelect event of the TreeView to set the font of the node, its parent and all its ancestors to bold, when another node is selected, i set the new node and its ancestors to bold, while returning the previously selected node to the normal font of the TreeView . By removing the while... statement in both methods, only the selected node is set to bold and back to normal. I know there are most likely better solutions but this one works fine.

<code>Dim previousSelectedNode as TreeNode
...
...
Private Sub Treeview1_AfterSelect(ByVal sender As System.Object, ByVal e As _ System.Windows.Forms.TreeViewEventArgs) Handles Treeview1.AfterSelect
        Dim xnode As TreeNode
        If previousSelectedNode IsNot Nothing Then DeSelectNode()
        e.Node.NodeFont = New Font(Treeview1.Font, FontStyle.Bold)
        xnode = e.Node
        While xnode.Parent IsNot Nothing
            xnode = xnode.Parent
            xnode.NodeFont = New Font(Treeview1.Font, FontStyle.Bold)
        End While
        previousSelectedNode = e.Node
End Sub


'Deselecting a node
Private Sub DeSelectNode()
        previousSelectedNode.NodeFont = Treeview1.Font
        While previousSelectedNode.Parent IsNot Nothing
            previousSelectedNode = previousSelectedNode.Parent
            previousSelectedNode.NodeFont = Treeview1.Font
        End While
End Sub

Questiondrag and drop from listbox to a datagridview Pin
Mr Oizo26-Sep-07 0:29
Mr Oizo26-Sep-07 0:29 
QuestionMusic scheduling advice? Pin
Mr Oizo25-Sep-07 23:53
Mr Oizo25-Sep-07 23:53 
AnswerRe: Music scheduling advice? Pin
Scott Dorman26-Sep-07 3:51
professionalScott Dorman26-Sep-07 3:51 
QuestionMusic Schedule advice? Pin
Mr Oizo25-Sep-07 23:45
Mr Oizo25-Sep-07 23:45 
Questionfocus problem Pin
Tom Deketelaere25-Sep-07 23:07
professionalTom Deketelaere25-Sep-07 23:07 
AnswerRe: focus problem Pin
Hesbon Ongira25-Sep-07 23:56
Hesbon Ongira25-Sep-07 23:56 
GeneralRe: focus problem Pin
Tom Deketelaere26-Sep-07 1:12
professionalTom Deketelaere26-Sep-07 1:12 
QuestionHow to get name of the .exe running in a machine.. Pin
Balagurunathan S25-Sep-07 21:37
Balagurunathan S25-Sep-07 21:37 
AnswerRe: How to get name of the .exe running in a machine.. Pin
Mbire26-Sep-07 0:35
Mbire26-Sep-07 0:35 
GeneralRe: How to get name of the .exe running in a machine.. Pin
Balagurunathan S26-Sep-07 20:27
Balagurunathan S26-Sep-07 20:27 
QuestionCrystal Report XI having an Error Access Denied .SetReportVariableValue(&amp;quot;parameter&amp;quot;,&amp;quot;value&amp;quot;) Please Help Urgent... [modified] Pin
vbDigger'z25-Sep-07 18:03
vbDigger'z25-Sep-07 18:03 
QuestionConnecting to Excel Pin
vidya11025-Sep-07 17:43
vidya11025-Sep-07 17:43 
AnswerRe: Connecting to Excel Pin
eyes200725-Sep-07 18:54
eyes200725-Sep-07 18:54 
GeneralRe: Connecting to Excel Pin
vidya11026-Sep-07 17:35
vidya11026-Sep-07 17:35 
QuestionUsing Application reference Pin
Mycroft Holmes25-Sep-07 14:58
professionalMycroft Holmes25-Sep-07 14:58 
AnswerRe: Using Application reference - amended Pin
Mycroft Holmes25-Sep-07 15:15
professionalMycroft Holmes25-Sep-07 15:15 
AnswerRe: Using Application reference - solved Pin
Mycroft Holmes25-Sep-07 15:26
professionalMycroft Holmes25-Sep-07 15:26 

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.