I have just done an application that will allow you to insert XML into
a 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(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim xmlstring As String = TextBox1.Text
'"<root><item>T revor</item><item>Niem ack</item><item>27 years
old</item><item>Marr ied</item><item>Empl oyed</item></root>"
Dim doc As New XmlDocument
doc.LoadXml(xml string)
Dim node As XmlNode
If used = True Then
used = False
End If
For Each node In doc.SelectNodes (TextBox3.Text)
ListBox1.Items. Add(node.InnerT ext)
used = True
Next
End Sub
Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button2.Click
ListBox1.Items. Clear()
used = False
End Sub
End Class 6 1407
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.IndexO f(wordToFind, 0)
2. Select that particular word.
RTB.Select(idx, wordToFind.Leng th)
3. Make changes to it's Font :
RTB.SelectionFo nt = New Font(RTB.Font, FontStyle.Under line)
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
--
Programming 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)
<tr************ @za.syspro.com> schreef in bericht
news:11******** *************@t 31g2000cwb.goog legroups.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.
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
--
Programming 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" <zo*****@sify.c om> schreef in bericht
news:11******** **************@ e56g2000cwe.goo glegroups.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.IndexO f(wordToFind, 0)
2. Select that particular word.
RTB.Select(idx, wordToFind.Leng th)
3. Make changes to it's Font :
RTB.SelectionFo nt = New Font(RTB.Font, FontStyle.Under line)
I guess that should do it. I've typed it here itself, so please watch for syntax.
Regards,
Cerebrus.
Lol, Peter... Happens to me all the time...
Regards,
Cerebrus. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: ajay |
last post by:
I have following code for a slide menu but i twiked it to work for a
single level menu. Open it in a Browser to get a clear picture.
I have 2 Qs
1) How to make first entry as non-link. i.e i want to make first text
as Table Heading/menu category. For examle in the given menu i want to
make a heading as "Comp. Languages" which won't be a link.
2) The position of this menu is absolute to the page. I want to make
it absolute to the Table...
|
by: Radith Silva |
last post by:
I have the following code:
Private Sub Bold(ByVal sender As Object, ByVal e As System.EventArgs)
Handles mnuFileBold.Click
If mnuFileBold.Checked = True Then
mnuFileBold.Checked = False
ElseIf mnuFileBold.Checked = False Then
mnuFileBold.Checked = True
End If
|
by: Sakharam Phapale |
last post by:
Hi All,
How to preserve the old font properties while changing new one?
I posted same question 2 months back, but I had very small time then.
eg. "Shopping for" is a text in RichTextBox and already formatted as
"Shopping" ---Bold
"for" -----Regular
Now I want to underline whole text by preserving old style i.e. Bold and
|
by: Novice Computer User |
last post by:
Hi. Can somebody PLEASE help. Here is a .php script. Right now, the
minimum amount of time (i.e. duration) allowed is 1 month. However, I
want to be able to reduce the minimum amount of time to 2 days (i.e.
48 hours).
Can somebody PLEASE PLEASE tell me what I need to change in this file
to do this? Here is a copy - thanks enormously in advance:
<html>
<head>
|
by: Jason |
last post by:
If I've got
Me.RichTextBox1.Text = "In Ricn Tex Box"
Me.RichTextBox1.Text &= "Line two" & vbCrLf
How do I make the first line appear BOLD?
| |
by: Henry Jones |
last post by:
I found some code to change the font on a button to bold:
private void btnBold_Click(object sender, System.EventArgs e)
{
btnCalculate.Font = new Font(btnCalculate.Font,
btnCalculate.Font.Style | FontStyle.Bold);
|
by: benfly08 |
last post by:
Hi, guys.
I'm developing a web application for Sales Department people in my company. I used my 1024X768 resolution and "Medium" IE text size to test my Layout and it worked fine. However, some people in Sales Department use different settings like "800X600", "Larger" IE text size or even "Large font" in Appearance tab in Display Property. Those different settings would mess up my layout. What I want to do is to set font size of labels,...
|
by: Ben |
last post by:
Hi
I am having problems making a single node's Font Bold.
objUserTree.Nodes.Item(i)
I am looping though the items but with every property I try it fails.
Thanks
|
by: Ronald S. Cook |
last post by:
How do I make a label bold at runtime (i.e. in code)?
Thanks,
Ron
|
by: Alexey Smirnov |
last post by:
How to make bold part of the text in a Windows.Forms.Label? Thank you.
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |