473,480 Members | 3,017 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how do i highlight the background of a textBox?

74 New Member
Hello,

I am new to C#/ASP.NET so im not quite sure how to go about doing this. I am building a website which allows users to upload documents in .pdf, .html or .txt. I then take the uploaded file, convert .pdf and .html files to .txt and send the files to a database. When the user clicks on the database, they will be presented with the titles of each document and when the click the document they want, another window opens up and displays the content of the document as a text.
My question is the following: if i wanted to implement a feature where the user clicks a button called "highlight", the user will then be expected to select the text they want to highlight and change the background of that text to some other color, i.e yellow. How would i go about doing this?
I have searched the internet but i can't quite seem to get results for what im looking for. The results i keep getting are for selecting the whole textbox and changing the background color. What i need to do is be able to select multiple intervals anywhere on my text to change the background of that specific text, to give the impression that the text has been highlighted with a highlighter. Exactly the way bytes.com does it when a user asks a question, in the "Give us more details... (required) section, the last bullet is
  • For programmers: place all code in [ CODE ] . . . [ /CODE ] tags

Where everything from the word "place all code... tags" has a green background. I need that, being controlled by a button called "highlighting" Any ideas?

here is the code snippet of where i load the file from the DB, in case that helps:

Expand|Select|Wrap|Line Numbers
  1. NSTFile file = ComplianceMapper.FindComplianceDocumentByName(fileName);
  2.  
  3.             StreamReader tr = new StreamReader(new MemoryStream(file.ByteContent));
  4.             TextBox1.Text = tr.ReadToEnd();
  5.             tr.Close();
  6.  
Thank you!
Feb 24 '11 #1
1 1678
Leito
58 New Member
Did you tried using the Select() method ?
See MSDN help.
Feb 24 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
8528
by: Karen | last post by:
I'm having trouble getting input from a textbox in Visual Basic 6.0 Private Sub cmdGetNumber_Click() txtInput.Text = Str(Int(1000 * Rnd)) End Sub The error message states: "Method or data...
1
4963
by: Gerg | last post by:
The datagrid has a tablestyle applied to it, and there are DataGridTextBoxColumn and each DataGridTextBoxColumn has an array of DataGridTextBox objects. Private Sub highlight(ByVal str As...
6
7708
by: dyw55a | last post by:
How to implement mm/dd/yyyy format for textbox? I have text box with format mm/dd/yyyy. Now I want the cursor i generated whenever user highlight this textbox and whatever user inpu replace one...
0
1415
by: Chris Fink | last post by:
I am having a problem highlighting a row in a datalist during the itemdatabound event. What is occurring is that a new td row is being wrapped around the datalist item which is highlighted (very...
2
5146
by: Simon | last post by:
I've only recently got started using VB.net Compact Framework, and I'm struggling to create a read-only Textbox with a white background. Even though I can set the background colour of a textbox,...
0
802
by: Hossein | last post by:
Hello everybody how can I highlight the all line (between two dots) where match keyword is find? Now I can just highlight the match keyword. thanks Hossein
35
5993
by: shapper | last post by:
Hello, I am creating a search engine which searches keywords inside SQL database and displays the results in a web page. In the results web page I would like to give a grey background to the...
2
2905
by: Celeste | last post by:
Hello, I'm trying to parse the referring url for google search terms so that when this page loads it will scroll to and highlight the search term(s). Should i be using document.referrer? ...
4
3787
by: HenrikL | last post by:
Hi! I have textbox that have fixed size in GUI and I need to know how many character I can put into it. For example, the textbox can contain 5 character in GUI and I wan to check if this string...
1
1816
by: pazazuzu | last post by:
Hello, I have been having problems with some code I am writing and have not been able to figure out what I am doing wrong, even after some debugging. I have a textbox that users can input any...
0
6920
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...
1
6760
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...
0
7022
tracyyun
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...
0
5365
agi2029
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,...
1
4799
isladogs
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...
0
3013
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1311
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 ...
1
572
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.