473,606 Members | 2,825 Online
Bytes | Software Development & Data Engineering Community
+ 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 "highlighti ng" 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 1682
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
8534
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 member not found" The properties window of the textbox has "txtInput" next to "Name"
1
4994
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 String) Dim myTextBoxcolumn As DataGridTextBoxColumn Dim myTextBox As DataGridTextBox 'loop through the cells of the datagrid, searching for the string
6
7719
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 of char in "mm/dd/yyyy" one at a time. I will be appreciated if anyone could give me some idea to implemen this through JavaScript. thanks,
0
1424
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 small), but the actual row that I want to be highlighted is not. Style is being applied to the wrong td row. Following is my code for webform: <asp:datalist ID="dlSmartKeys" Width="700" CellPadding="0" CellSpacing="0" Runat="server">...
2
5160
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, as soon as I set the control to read-only it turns the background grey. Unfortunately I can't set the enabled property to false as sometimes I need the scrollbars to work on the Textbox. I did think about using a label instead of a Textbox, but...
0
810
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
6019
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 words which were used as Keywords for the search. How can I do this?
2
2917
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? Please take a look at my code and tell me what i'm doing wrong: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <title>highlight</title>
4
3796
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 "234567.333" is not to large for the textbox, if it is then I wan to highlight the textbox.text = "#####" (like exel). Is there any easy way to count how many character a fixed size textbox can contain? Cant use Graphics.MeasureString method...
1
1826
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 letters into, that should should search the item field boxes and highlight any matching strings. If a matching search is made, then the item box should remain yellow, and the other item boxes should be white. It does not have to be a perfect...
0
8045
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7981
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,...
0
8467
Oralloy
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...
0
8462
jinu1996
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...
0
6803
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, 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...
0
5470
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3952
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4011
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1574
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.