|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Make font Bolda text box then do an xpath query to return the values against the node. I am just a beginner so for me this is really cool but I want to be able to get the nodes that returned information to be highlighted. This is an example of my code at current: Imports System.Xml Public Class Form1 Dim used As Boolean Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim xmlstring As String = TextBox1.Text '"<root><item>Trevor</item><item>Niemack</item><item>27 years old</item><item>Married</item><item>Employed</item></root>" Dim doc As New XmlDocument doc.LoadXml(xmlstring) Dim node As XmlNode If used = True Then used = False End If For Each node In doc.SelectNodes(TextBox3.Text) ListBox1.Items.Add(node.InnerText) used = True Next End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click ListBox1.Items.Clear() used = False End Sub End Class Hi Trevor,
You'll need to use a RichTextBox control if you want to show the returned nodes in Bold. A simple TextBox won't do. You can drag it onto your form from the Toolbox. HTH, Regards, Cerebrus. Thank you for the suggestion but now that I have inserted the
richtextbox I still am not sure of how to only bold selected nodes. I'm sorry, I assumed you would have worked out that logic... Never
mind, here is one possible way : 1. You'll have to search for that particular word in the Text of the RichTextBox(RTB), using the IndexOf method. When you do find it, store the index position : Dim idx as integer = RTB.Text.IndexOf(wordToFind, 0) 2. Select that particular word. RTB.Select(idx, wordToFind.Length) 3. Make changes to it's Font : RTB.SelectionFont = New Font(RTB.Font, FontStyle.Underline) I guess that should do it. I've typed it here itself, so please watch for syntax. Regards, Cerebrus. I can now see that my post was a bit late and Cerebrus already answered, but
that's because I forget to press F5 before posting :-) Greetz Peter -- Show quoteHide quoteProgramming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. (Rich Cook) "Cerebrus" <zorg***@sify.com> schreef in bericht news:1145887919.680968.114000@e56g2000cwe.googlegroups.com... > I'm sorry, I assumed you would have worked out that logic... Never > mind, here is one possible way : > > 1. You'll have to search for that particular word in the Text of the > RichTextBox(RTB), using the IndexOf method. > When you do find it, store the index position : > > Dim idx as integer = RTB.Text.IndexOf(wordToFind, 0) > > 2. Select that particular word. > > RTB.Select(idx, wordToFind.Length) > > 3. Make changes to it's Font : > > RTB.SelectionFont = New Font(RTB.Font, FontStyle.Underline) > > I guess that should do it. I've typed it here itself, so please watch > for syntax. > > Regards, > > Cerebrus. > Hi have a look at the SelectionFont property of the richtextbox that should
do what you want Greetz Peter -- Show quoteHide quoteProgramming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. (Rich Cook) <trevor.niem***@za.syspro.com> schreef in bericht news:1145871159.171656.55350@t31g2000cwb.googlegroups.com... > Thank you for the suggestion but now that I have inserted the > richtextbox I still am not sure of how to only bold selected nodes. >
[DATE - newbie] change and set back
GetDirectories Performance Iterate through page controls How to put a Word/Excel file into a database Impersonation help with SQL 2000 needed Job title: $300 flat for job in perl, cgi, Visual Basic/Asp.Net, whatever online project A Question of form focus - VB.NET 2003 Problem with generating file shortcut in VB A couple of easy datagrid questions wav files in programs |
|||||||||||||||||||||||