Write a program in VB.NET to create a simple editor.Create a button that will allow the user to access function like file open,save,find.


Imports System.IO

Public Class Form1

    Dim filename As String

    Dim searh As String

    Dim sr As StreamReader

    Dim sw As StreamWriter


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


        If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then

            filename = SaveFileDialog1.FileName

            sw = New StreamWriter(filename)

            sw.Write(RichTextBox1.Text)

            sw.Close()

        End If


    End Sub


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

        RichTextBox1.Text = ""


        If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then

            filename = OpenFileDialog1.FileName

            sr = New StreamReader(OpenFileDialog1.OpenFile)

            RichTextBox1.Text = sr.ReadToEnd()

            sr.Close()

        End If

    End Sub


    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        searh = InputBox("Enter The String To find")

        RichTextBox1.SelectionStart = RichTextBox1.Find(searh)

        Dim boldfont As New Font(RichTextBox1.Font, FontStyle.Bold)

        RichTextBox1.SelectionFont = boldfont


    End Sub


    Private Sub SaveFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles SaveFileDialog1.FileOk


    End Sub

End Class
Write a program in VB.NET to create a simple editor.Create a button that will allow the user to access function like file open,save,find. Write a program in VB.NET to create a simple editor.Create a button that will allow the user to access function like file open,save,find. Reviewed by on April 27, 2015 Rating: 5
Powered by Blogger.