.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

RichTextbox bold

Posted By:      Posted Date: September 17, 2010    Points: 0   Category :Windows Application
hey, I am having trubble amkign the text in the richtextbox bold..I used this code: thisrichtextbox.SelectionFont.Bold = true; but it gives me this error: Property or indexer 'System.Drawing.Font.Bold' cannot be assigned to -- it is read only     Thanks:)

View Complete Post

More Related Resource Links

Making textarea bold on IE7



I need to make the textarea content bold.

<b><textarea rows=2 cols=5>some text</textarea></b>

This works on IE6 browser but not on IE7.

Any ideas?




link buttons are not working in Blackberry bold (9650, 9700)



we have deveoped a mobile application . and have some link buttons  ,thease linkbuttons are working fine with blackberry curve but not working when we use Blackberry bold (9650, 9700)


Printing RichtextBox

I was using the following code to print the contents of a richtextbox:         pd.PrintDocument(((CType(Me.richTextBox.Document, IDocumentPaginatorSource)).DocumentPaginator), "printing as paginator")but it prints in 3 columns. So i tried using this code but it does not print InluneUiContainersDim docWriter As XpsDocumentWriter = PrintQueue.CreateXpsDocumentWriter(ia)     If (docWriter IsNot Nothing And ia IsNot Nothing) Then         Dim paginator As DocumentPaginator = CType(fd, IDocumentPaginatorSource).DocumentPaginator         'Change the PageSize and PagePadding for the document to match the CanvasSize for the printer device.         paginator.PageSize = New Size(ia.MediaSizeWidth, ia.MediaSizeHeight)         Dim pagePadding As Thickness = fd.PagePadding         fd.PagePadding = New Thickness    (Math.Max    (ia.OriginWidth,     pagePadding.Left),     Math.Max    (ia.OriginHeight,     pagePadding.Top),         Math.Max(ia.MediaSizeWidth - (ia.OriginWidth + ia.ExtentWidth), pagePadding.Right), Math.Max(ia.MediaSizeHeight - (ia.OriginHeight + ia.ExtentHeight), pagePadding.Bottom))     fd.ColumnWidth = Double.PositiveInfinity     'Send DocumentPaginator to the printer.     docWriter.Write(paginator) End If Also tried the following but this is completely wrong:        pd.PrintVisual(CType(Me.richTextBox, Visual), "printing as visual")Any ideas?

RichTextBox - Attached Properties, Document and CaretPosition

Hi I have created a couple of attached properties for the richtextbox control, to enable binding to the Document and CaretPosition native properties of the richtextbox. However, I am finding that, when I am programmatically updating the richtextbox document from the view model (rather than typing it into the richtextbox directly), I need to manually set the CaretPosition property of the richtextbox (see the underlined piece of code for the additional manual setting of CaretPosition) whereas the Document property appears to be updating automatically. At least when I step the code and break in on I'm concerned that I've not quite wired this together properly and would be grateful if someone could explain where I've got it wrong. The relevant  XAML is  <RichTextBox x:Name="rtb" Height="auto" Width="auto" local:RichTextBoxExtensions.CaretPosition="{Binding CaretPosition, Mode=TwoWay}" local:RichTextBoxExtensions.CurrentText="{Binding CurrentText, Mode=TwoWay}" cal:Message.Attach="[Event TextChanged] = [Action CheckForPopup]; [Event PreviewKeyUp] = [Action KeyPress($eventArgs)]"> <local:RichTextBoxExtensions.Document> <MultiBinding Converter="{StaticResource IntellisenseController}"> <Binding Path="CurrentDocument" Mode=&qu

DropDownList to display values from Two Tables - bold sub heading and normal Text

Hello I hope I am not asking simple one.  SUPPORT SERVICES<     Computing Service    Library or Data Engineering    Civil Engineering    Electrical Engineering  I have the data to display in a DropDownList control shown as above. There is a distinct category Type(example Support Services) and Category Name i.e., Computing Services. I do not want to hard code the values into DropDownList control. I like to get the data from database to display as shown in above Table. Note that Category Type should be displayed in Bold and Category Name in normal Text. Question: In order to achieve the above, 1. How many database Tables and relationships between them  2. Query the data to display in the above format in drop down 3. how should be the code behind i.e, DataTextValue and DataValueField for DropDownList. Please provide with useful code snippets or references. Thanks,

Full desired height of a RichTextBox control?

I don't mean the control's .Height property... ...I have a WinForm with a RichTextBox control, and another control underneath the RichTextBox control.  The RichTextBox control is anchored on the left, top, and right sides, so the width is automatically resized as the parent form is resized.  (it also has its Multiline and and WordWrap properties set to True) The item underneath the RichTextBox needs to always be right underneath it (little whitespace), and the RichTextBox needs to always display its entire text (nothing hidden). As I get the form's resize event, I'd like to update the RichTextBox's hight so all text is displayed, however I'm not seeing any properities or methods which would be helpful.  There is the PrefferredHeight property, but it is always returning 13. Basically, it comes dowen to this: when WordWrap is set to true, is there a way to see what the desired height is?  Or is there a way to see if any of the text is clipped? If not, I suppose my next step would be to roll my own custom control and draw the text myself, keeping track of the autowrap and line count, but I thought I'd post a message here first and see if anyone has a better idea. Thanks, Jeff      

double spin text in richtextbox

i want to implement this feature : if i have a following sentence : {my name is james vick and iam a {member|user|visitor} on this {forum|website|site} and iam loving it | iam admin and iam a {supervisor|admin|moderator} on this {forum|website|site} and iam loving it} on a click of button i want to generate this : my name is james vick and iam a member on this site and iam loving it or iam admin and iam a admin on this forum and iam loving it The basic need is to randomly choose words between {|} braces I have been able to do this for inner nest i.e. for {member|user|visitor}. But how to include the outer nest of sentences also i.e. {something blah blah {blah1|blah2} and | something else} ? code for inner nest : Private Sub SimpleButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SimpleButton3.Click Dim stringWithTextIn As String = RichTextBox1.Text Dim regex As New Regex("{(.*?)}") Dim r As String = regex.Replace(stringWithTextIn, New MatchEvaluator(AddressOf ReplaceMatch)) RichTextBox2.Text = r End Sub Private Function ReplaceMatch(ByVal m As Match) As String Dim parts = m.Groups(1).Value.Split("|"c) Return parts(r.Next(0, parts.Length)) End Function i know i just have to change the regex but what do i add in it to include outer braces?

missing event in RichTextBox

I'm developing an application that uses the RichTextBox extensively, I need an event that gets triggered at the moment when the vertical scroll bar of the richTectBox appears . so instead of scrolling down to see the rest of the text I want to create another RichTextBox that will hold the rest of the text which didn't fit in the first one …I want to achieve the same functionality as in MS word. I tried so hard to achieve that functionality but it wasn't successfull … I tried to fake it using the SizeChanged event but it wasn't practical because the size of the richTextBox gets changed a lot during the life time of the application   is there such event in windows forms ? … and if not , is there one in WPF ?

Font on Page Becomes Bold After Javascript Alert -- Why?

In .Net 3.5   I have a web page that has several checkboxes, text boxes, dropdown boxes etc on it.  When a user clicks on the search button, I run some basic validation on the page. If any validation fails, I invoke a javascript alert letting them know what they did wrong and I return them to the page. However, when the page reloads, all of the text on the page is now larger and bold, even the text inside the menu and which resides in a master page.  I removed every instance of the word "bold" from the project but it still becomes bold after the alert fires. Any idea what could be causing this to happen?  It shouldnt matter but here is a sample of the alert I use: Response.Write("<script language='javascript'>alert('You must check at least one column to display');</script>") Any help is greatly appreciated. thanks

I installed .net FrameWork 4.0 (for Vista/Windows 7) and my Desktop Font is BOLD! (sometimes)

So at first, I installed the below: http://www.microsoft.com/downloads/details.aspx?FamilyID=9cfb2d51-5ff4-4491-b0e5-b386f32c0992&displaylang=en Which is .net framework 4 (web installer), then I believe I tried the standalone. But then after I did the Redistributable 2.0 installer for Windows XP SP2, but I have SP3, does that just mean its included already? (http://www.microsoft.com/downloads/en/details.aspx?FamilyID=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&displaylang=en)   My friend told me I needed this before I install Office 2010... I dont know!! So after I installed these different .net frameworks and then office. I have Mozilla crashing me, I disabled the framework assistant plug-in and still happens. Then, my FONT for desktop and start menu icons turns (larger/bold) but not within folders, only what shows without clicking into anything.... so.. 1.System Restore is not an option, that restore point is overwritten now... 2. This is not an appearance tab/settings issue with a larger DPI set or anything like that... Because, sometimes I click on my computer to restart and the font is all fine and will continue to be, othertimes, some program or something causes this to happen, I restart the PC and then its fine again... Can anyone tell me what I did wrong and how to fix it, easily.. if possible :) I have searched all over and while I've noticed people with simila

Display records in bold coming from mysql database

hi,I have Mysql database.In that some records status is New.now,I bind database table to Listview(asp) control.What's my problem is,the New status records(from Mysql database) text in Listview(after binding) is visible in bold format.how to do this??Thanks in advance.

Problem when Append DataFormats.xamlPackage RichTextBox

public partial class Window12 : Window { public Window12() { InitializeComponent(); } FileStream fStream; private void btnClick_Click(object sender, RoutedEventArgs e) { TextRange ran = new TextRange(txtMsg.Document.ContentStart, txtMsg.Document.ContentEnd); ran.Save(fStream, DataFormats.XamlPackage); txtMsg.Document.Blocks.Clear(); txtMsg.Focus(); } private void Window_Loaded(object sender, RoutedEventArgs e) { string fileName = @"D:\\part1.xaml"; if (File.Exists(fileName)) fStream = new FileStream(fileName, FileMode.Append, FileAccess.Write); else fStream = new FileStream(fileName, FileMode.Create); txtMsg.Focus(); } private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { fStream.Close(); } } Hi, I have WPF RichTextbox and a button When I insert the text or Image and Click the button the text will save in D: drive with DataFormats.XamlPackage Initially it works fine, when I try to append the text (Close window and open again then insert the text )It gives the error in range.Save(fStream,DataFormats.XamlPackage); Error Message:Cannot open package because FileMode or FileAccess value is not valid for the stream.am

Possibly Severe Bug in Windows Forms / TextBox / RichTextBox, Windows Freezing

Problem: Windows Message Processing (in all running apps) completely freezing periodically for about 10 seconds when using certain combination of Forms properties on a form with a TextBox/RichTextBox. This behaviour might not be limited to the two controls. The weird behaviour starts with but is not limited to scrolling text in the textbox with the mousewheel. Using: Visual Studio 2008, Visual Basic, compiling for .NET Framework 3.5 (Any) OS: Windows XP SP3 Reproduce: Open new project, add a new form named TestForm, add a TextBox named TextBox1, enable scrollbars on the TextBox. Add the following function to the form: Public Class TestForm     Private Sub TestForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load         ' CONDITIONS WHEN STARTS TO SLOW DOWN:         ' Form.Opacity < 1.0         ' Form.BackColor = Form.TransparencyKey (= whole form is transparent)         ' this makes the form completely transparent         BackColor = Color.Red         TransparencyKey = Color.Red         ' NOTE: when this is set it starts to slow down         Opac

How can I hide the caret of a RichTextBox control?

Hello,Can you please tell me how can I hide the caret of a RichTextBox control completely while my app is running?Thanks.

How to make bold/regular font text the same width

Hi! In Excel the width of texts in bold font cells have the same width as regular font ones. My question is how to do that programmatically (in a DataGridView, labels, paint event, anywhere...). I can do this if I draw the string twice in the paint event (1 pixel shift for the second draw), but it requires 2 drawings of course, which I think is not too efficient. Is there any other solution? Some trick in creating the bold font? Thank you, Feri

Richtextbox - how can I find out what lines are currently visible?

I have a scrolling richtextbox that holds more lines than it can display, and I would like to know what lines are currently being displayed.  I'm looking for some method like GetTopVisibleLine, GetBottomVisibleLine, GetFirstVisibleCharIndex, GetLastVisibleCharIndex, etc. and I don't seem to be able to find anything that will give me this info.  Any ideas? Thanks, Mike
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend