Article
    C#
    ADO.Net
    .NET
    ASP.Net & Web Forms
    Custom Controls
    Web Development
    Exception Handling
    XML
    Database
    Security in .Net
    Testing
    Web Services
    Windows Services
    Windows Controls
    WCF
    AJAX
    WPF
    XAML
    Reporting
    Setup
    VB.Net
    LINQ
    JQuery
    SilverLight
    JavaScript
    HTML5
    Crystal Report
    Cloud Computing
    Share Point
    Visual C++
    MVC
    Android
    PHP
    Java
    HTML
    WordPress
    Joomla
    Products
    Drupal
    Windows Phone
    JSON
    LightSwitch
    iPhone/iPad
    Ruby on Rails
    IIS 7
    Windows 8
    CSS/CSS3
    Excel
    MS Access
    Shortcut Keys
    Visual SourceSafe
    Team Foundation Server
    API(s)
    Sencha-Touch
    Single Page App
    Bootstrap
Follow Us
Follow _MindStick_ on Twitter View MindStick Software's LinkedIn profile View MindStick Software's Facebook profile
Top Contributor
Advertisement
Advertise with Us
Mindstick
Article Article  Forum Forum  Blog Blog  Quiz Quiz  Beginner Beginner  Careers Careers  Contact Contact  Login Login  
Home | Product | Services | About Us | Interview | DeveloperSection | Submit an Article | Submit Blog

Home >> VB.Net >> RichTextBox Control in VB.Net
RichTextBox Control in VB.Net
RichTextBox Control in VB.Net


by John Smith on 12/13/2010 5:41:58 PM

Views: 5953       Comments: 0

RichTextBox Control in VB.Net

RichTextBox allows formatting the text. It also provides facility to save the text in file and restore from file.

Drag and drop RichTextBox control from toolbox on the window Form.

RichTextBox Control in VB.Net

Write the Text in RichTextBox

RichTextBox Control in VB.Net

Code:

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

 

        'Find method is used to find the text written in RichTextBox

        RichTextBox1.SelectionStart = RichTextBox1.Find("Hello")

        RichTextBox1.SelectionColor = Color.BlueViolet

        RichTextBox1.SelectionStart = RichTextBox1.Find("How are you")

        RichTextBox1.SelectionColor = Color.DarkOliveGreen

 

    End Sub

End Class

Run the Project

RichTextBox Control in VB.Net

Save RichTextBox Text in File

Code:

  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

       ' SaveFile Method Saves the contents of the RichTextBox to a file.

        RichTextBox1.SaveFile("hello.rtf")

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

  'LoadFile Method Loads the contents of a file into the RichTextBox control.

        RichTextBox2.LoadFile("hello.rtf")

    End Sub

Run the Project

RichTextBox Control in VB.Net

When you click save button then written text will save to the specified file and in specified path.

When you click Load button then saved file will load in RichTextBox2

 

RichTextBox Control in VB.Net

 

 

 

 

 

 

 

Report Abuse Form
Reason:    
 

Title :
Comment :
Text ColorBackground Color
BoldItalicUnderline
LeftCenterRightJustify
Ordered ListBulleted List
IndentOutdent
Horizontal Rule
SubscriptSuperscript
HyperlinkImage
Design ModeDesign
View HtmlHtml
     
 
Latest Article by John SmithRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Latest BlogsRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Top Viewed ArticlesRSS Feed
    
    
    
    
    
    
    
    
    
    
Top Viewed BlogsRSS Feed
    
    
    
    
    
    
    
    
    
    
Latest Interview QuestionsRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Total Online Users: 3792
Advertisement
MindStick DataConver
Advertise with Us
  
Copyright © 2009 - 2014MindStick. All Rights Reserved.