Treceți la conținutul principal

texteditor vbnet

//form1.vb




Imports System.Windows.Forms
Imports System
Imports System.Drawing.Printing
Imports System.IO

Public Class Form1
    Dim SaFacutModificari As Boolean = False
    Dim SaDeschisUnFisier As Boolean = False
    Dim SaFacutSalvarea As Boolean = False
    Dim SaWrapActiv As Boolean = True
    Dim SaCautCuvant As String
    Dim SaFindFromLocation As Integer = 0
    Dim FisierCurent As String



    Private Sub Form1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.GotFocus
        Call Initializare()
    End Sub

    Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
        Call Initializare()
    End Sub

    Private Sub Initializare()
        RichTextBox2.WordWrap = False
        RichTextBox2.ScrollBars = RichTextBoxScrollBars.ForcedBoth
        RichTextBox2.Left = 2
        RichTextBox2.Height = Me.Height() - 100
        RichTextBox2.Width = Me.Width() - 10
    End Sub

    Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click
        Call savefile()
    End Sub
    Private Sub savefile()
        SaveFileDialog1.ShowDialog()
        If (SaveFileDialog1.FileName <> "") Then
            RichTextBox2.SaveFile(SaveFileDialog1.FileName, RichTextBoxStreamType.RichText)
        End If
    End Sub

    Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click
        OpenFileDialog1.ShowDialog()
        RichTextBox2.LoadFile(OpenFileDialog1.FileName)
        FisierCurent = OpenFileDialog1.FileName
        SaDeschisUnFisier = True
        Me.Text = OpenFileDialog1.FileName
        FisierCurent = Me.Text
    End Sub


    Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
        Call exitapp()
    End Sub

    Private Sub RichTextBox2_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles RichTextBox2.MouseDown

    End Sub

    Private Sub RichTextBox2_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles RichTextBox2.MouseEnter
        ToolStripStatusLabel1.Text = RichTextBox2.GetLineFromCharIndex(1)
    End Sub

    Private Sub RichTextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox2.TextChanged
        SaFacutModificari = True
    End Sub

    Private Sub NewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripMenuItem.Click
        Call closefile()
    End Sub

    Private Sub exitapp()
        Dim raspuns
        If SaFacutModificari <> True Then
            Application.Exit()
        Else
            raspuns = MessageBox.Show("Saving your work ?", "Save your work?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning)
            If raspuns = vbYes And FisierCurent = "" Then
                SaveFileDialog1.ShowDialog()
                If SaveFileDialog1.FileName <> "" Then
                    RichTextBox2.SaveFile(SaveFileDialog1.FileName, RichTextBoxStreamType.RichText)
                    Me.Text = SaveFileDialog1.FileName
                End If

                If Me.Text = SaveFileDialog1.FileName Then
                    SaFacutSalvarea = True
                    SaFacutModificari = False
                    Application.Exit()
                End If
            End If

            If raspuns = vbYes And FisierCurent <> "" Then
                RichTextBox2.SaveFile(OpenFileDialog1.FileName, RichTextBoxStreamType.RichText)
                SaFacutSalvarea = True
                SaFacutModificari = False
                Application.Exit()
            End If

            If raspuns = vbNo Then
                Application.Exit()
            End If
        End If

    End Sub

    Private Sub closefile()
        Dim raspuns
        If SaFacutModificari <> True Then
            Call clearall()
        Else
            raspuns = MessageBox.Show("Saving your work ?", "Save your work?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning)
            If raspuns = vbYes And FisierCurent = "" Then
                SaveFileDialog1.ShowDialog()
                If SaveFileDialog1.FileName <> "" Then
                    RichTextBox2.SaveFile(SaveFileDialog1.FileName, RichTextBoxStreamType.RichText)
                    Me.Text = SaveFileDialog1.FileName
                End If
                If Me.Text = SaveFileDialog1.FileName Then
                    SaFacutSalvarea = True
                    SaFacutModificari = False
                    RichTextBox2.Text = ""
                End If
            End If
            If raspuns = vbYes And FisierCurent <> "" Then
                RichTextBox2.SaveFile(OpenFileDialog1.FileName, RichTextBoxStreamType.RichText)
                SaFacutSalvarea = True
                SaFacutModificari = False
                Call clearall()
            End If
            If raspuns = vbNo Then
                Call clearall()
            End If
        End If
    End Sub

    Private Sub clearall()
        RichTextBox2.Clear()
        SaFacutModificari = False
        SaDeschisUnFisier = False
        SaFacutSalvarea = False
        FisierCurent = ""
        Me.Text = "New File"
    End Sub

    Private Sub CloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseToolStripMenuItem.Click
        Call closefile()
    End Sub

    
    Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
        AboutBox1.Visible = True
    End Sub

    Private Sub UndoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UndoToolStripMenuItem.Click
        RichTextBox2.Undo()
    End Sub

    Private Sub RedoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RedoToolStripMenuItem.Click
        RichTextBox2.Redo()
    End Sub

    Private Sub CopyToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyToolStripMenuItem.Click
        RichTextBox2.Copy()
    End Sub

    Private Sub PasteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasteToolStripMenuItem.Click
        RichTextBox2.Paste()
    End Sub

    Private Sub CutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CutToolStripMenuItem.Click
        RichTextBox2.Cut()
    End Sub

    Private Sub DeleteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeleteToolStripMenuItem.Click
        RichTextBox2.Clear()
    End Sub

    Private Sub SelectAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectAllToolStripMenuItem.Click
        RichTextBox2.SelectAll()
    End Sub

    Private Sub WrapToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WrapToolStripMenuItem.Click
        If SaWrapActiv = True Then
            RichTextBox2.WordWrap = False
            SaWrapActiv = False
        Else
            RichTextBox2.WordWrap = True
            SaWrapActiv = True
        End If
    End Sub

    Private Sub PageSetupToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PageSetupToolStripMenuItem.Click
        'Call pagesetupcurrent()
    End Sub

    Private Sub PrintToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintToolStripMenuItem.Click
        ' Call printpreviewcurrent()
    End Sub

    Private Sub FindToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FindToolStripMenuItem.Click
        SaFindFromLocation = 0
        SaCautCuvant = InputBox("Find:", "Find:", "...")
        Call FindMyText(SaCautCuvant, SaFindFromLocation)
    End Sub

    Private Sub FindNextToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FindNextToolStripMenuItem.Click
        Call FindMyText(SaCautCuvant, SaFindFromLocation)
    End Sub

    Public Function FindMyText(ByVal text As String, ByVal start As Integer) As Integer

        Dim returnValue As Integer = -1
        SaFindFromLocation = RichTextBox2.Find(text, start, RichTextBoxFinds.None)
        SaFindFromLocation = SaFindFromLocation + 1
        returnValue = SaFindFromLocation
        Return returnValue

    End Function

    Private Sub ToolStripButton17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton17.Click
        Call FindMyText(SaCautCuvant, SaFindFromLocation)
    End Sub

    Private Sub TextToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextToolStripMenuItem.Click
        Dim converttotextfile As String = RichTextBox2.ToString()
        MsgBox(converttotextfile)
    End Sub

    
    Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
        'new
        Call closefile()
    End Sub

    Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click
        'open
        OpenFileDialog1.ShowDialog()
        RichTextBox2.LoadFile(OpenFileDialog1.FileName)
        FisierCurent = OpenFileDialog1.FileName
        SaDeschisUnFisier = True
        Me.Text = OpenFileDialog1.FileName
        FisierCurent = Me.Text
    End Sub

    Private Sub ToolStripButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton3.Click
        'save
        Call savefile()
    End Sub

    Private Sub ToolStripComboBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripComboBox1.Click
        'save as
        Call savefile()
    End Sub

    Private Sub ToolStripComboBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripComboBox2.Click
        'close
        Call closefile()
    End Sub

    Private Sub ToolStripComboBox3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripComboBox3.Click
        'print
        ' Call printcurrent()
    End Sub

    Private Sub ToolStripButton4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton4.Click
        'copy
        RichTextBox2.Copy()
    End Sub

    Private Sub ToolStripButton5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton5.Click
        'cut
        RichTextBox2.Cut()
    End Sub

    Private Sub ToolStripButton6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton6.Click
        'paste
        RichTextBox2.Paste()
    End Sub

    Private Sub ToolStripButton7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton7.Click
        'select all
        RichTextBox2.SelectAll()
    End Sub

    Private Sub ToolStripButton8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton8.Click
        'undo
        RichTextBox2.Undo()
    End Sub

    Private Sub ToolStripButton9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton9.Click
        'redo
        RichTextBox2.Redo()
    End Sub

    Private Sub ToolStripButton10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton10.Click
        'find
        SaFindFromLocation = 0
        SaCautCuvant = InputBox("Find:", "Find:", "...")
        Call FindMyText(SaCautCuvant, SaFindFromLocation)
    End Sub

    Private Sub ToolStripButton11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton11.Click
        'wrap
        If SaWrapActiv = True Then
            RichTextBox2.WordWrap = False
            SaWrapActiv = False
        Else
            RichTextBox2.WordWrap = True
            SaWrapActiv = True
        End If
    End Sub

    Private Sub ToolStripButton12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton12.Click
        'font
        'call setfont()
        FontDialog1.ShowDialog()
        RichTextBox2.Font = FontDialog1.Font
    End Sub

    Private Sub ToolStripButton13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton13.Click
        'size
        'call size()
    End Sub

    Private Sub ToolStripButton14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton14.Click
        'color
        'call color()
        ColorDialog1.ShowDialog()
        RichTextBox2.ForeColor = ColorDialog1.Color
    End Sub

    Private Sub ToolStripButton15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton15.Click
        'options
        'call option()
    End Sub

    Private Sub ToolStripButton16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton16.Click
        'replace
        'call replace()
    End Sub

    Private Sub SaveAsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveAsToolStripMenuItem.Click
        Call savefile()

    End Sub

    Private Sub HtmlToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HtmlToolStripMenuItem.Click
        'tohtmldoc
    End Sub

    Private Sub WordToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WordToolStripMenuItem.Click
        'toworddoc
    End Sub

    Private Sub GoToToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GoToToolStripMenuItem.Click
        'call gotoline()
    End Sub

    Private Sub ReplaceToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReplaceToolStripMenuItem.Click
        'call replace()
    End Sub

    Private Sub NewTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewTabToolStripMenuItem.Click
        'new tab
    End Sub

    Private Sub CloseTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseTabToolStripMenuItem.Click
        'close tab
    End Sub

    Private Sub ToolbarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolbarToolStripMenuItem.Click
        'toolbar
    End Sub

    Private Sub StatusBarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StatusBarToolStripMenuItem.Click
        'status bar
    End Sub

    Private Sub MeniuBarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MeniuBarToolStripMenuItem.Click
        'meniu
    End Sub

    Private Sub TextEditorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextEditorToolStripMenuItem.Click
        'texteditor
        Form3.Visible = True
    End Sub

    Private Sub RichTextEditorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextEditorToolStripMenuItem.Click
        'rtf editor
    End Sub

    Private Sub WebBrowserToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WebBrowserToolStripMenuItem.Click
        'web browser
        Form2.Visible = True

    End Sub

    Private Sub OptionsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OptionsToolStripMenuItem.Click
        'options
    End Sub

    Private Sub SpellingToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SpellingToolStripMenuItem.Click
        'spelling
    End Sub

    Private Sub TransformTextToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TransformTextToolStripMenuItem.Click
        'transformtext
    End Sub

    Private Sub ToolsToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolsToolStripMenuItem1.Click
        'custom app
    End Sub

    Private Sub NewWindowToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewWindowToolStripMenuItem.Click
        'new windows
    End Sub

    Private Sub HelpToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HelpToolStripMenuItem1.Click
        'help()
    End Sub
    
End Class


//form2.vb

Public Class Form2


    Private Sub INITIALIZAREBROWSER()

        WebBrowser1.ScrollBarsEnabled = True
        WebBrowser1.Left = 2
        WebBrowser1.Height = Me.Height() - 100
        WebBrowser1.Width = Me.Width() - 10
        TextBox1.Width = Me.Width - 200
        Button1.Left = TextBox1.Left + TextBox1.Width + 20
        WebBrowser1.Navigate("www.yahoo.com")
        TextBox1.Text = "www.yahoo.com"
        Me.Text = "Web browser minimalist TextEditor 0.00.0.1 Dev Stage." & TextBox1.Text

    End Sub

    Private Sub Form2_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
        If Keys.Enter Then
            WebBrowser1.Navigate(TextBox1.Text)
        End If
    End Sub

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Call INITIALIZAREBROWSER()
    End Sub

    Private Sub Form2_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
        Call INITIALIZAREBROWSER()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        WebBrowser1.Navigate(TextBox1.Text)
        Me.Text = "Web browser minimalist TextEditor 0.00.0.1 Dev Stage." & TextBox1.Text
    End Sub

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
        Form4.Visible = True
    End Sub


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


//form3.vb

Public Class Form3

    Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
        Dim answer As MsgBoxResult
        answer = MsgBox("Do you want to quit now?", MsgBoxStyle.YesNo)
        If answer = MsgBoxResult.Yes Then
            MsgBox("Terminating program")
            'End
            Me.Visible = False
        End If

    End Sub
End Class

Comentarii

Postări populare de pe acest blog

program principal cpp

#include "clasa.h" #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <string.h> #define DELAY 9000000 void delay() { for(long i=0;i<DELAY;i++); } //constructor cu initializare de la tastatura BigInt::BigInt() {char x; signed char t[400]; int i; printf("\nNumarul cu semn "); do s=getche(); while((s!='+')&&(s!='-')); n=0; do {x=getche(); t[n]=x-'0'; n++; } while((x>='0')&&(x<='9')); n--; for(i=0;i<n;i++) nr[i]=t[n-i-1]; } //constructor cu initializare prin parametri BigInt::BigInt(char semn,signed char numar[],int dim) {int i; s=semn; n=dim; for(i=0;i<n;i++) nr[i]=numar[n-i-1]; } //transform un int negativ in pozitiv int BigInt::Pozitiv(int x) {int a,vb; a=0; vb=0; while(vb==0) if((x+a)==0) vb=1; else a=a+1; x=a; return x; } //constructor dintr-un nr int obisnuit BigInt::BigInt(int x) {int i; if(x>=0) s='+'…

NUMERE PRIME ALGORITM C++

// NUMERE PRIME ALGORITM C++//  reediting from scratch //on this page is just the study for a next algoritm for generating the parime nr series like Fibonnaci or ....if possibile

74111121313417374414124343447 if u know the red part you can generate the orange part
1 0 1 111112222 1 1 23

o aplicatie php localitati romania

//APLICATIA SE REFERA LA BAZA DE DATE SIRUTA

//dragtable.js


/* dragtable v1.0 June 26, 2008 Dan Vanderkam, http://danvk.org/dragtable/ http://code.google.com/p/dragtable/ \Bsortabledraggable\B Instructions: - Download this file - Add <script src="dragtable.js"></script> to your HTML. - Add class="draggable" to any table you might like to reorder. - Drag the headers around to reorder them. This is code was based on: - Stuart Langridge's SortTable (kryogenix.org/code/browser/sorttable) - Mike Hall's draggable class (http://www.brainjar.com/dhtml/drag/) - A discussion of permuting table columns on comp.lang.javascript Licensed under the MIT license. */ // Here's the notice from Mike Hall's draggable script: //***************************************************************************** // Do not remove this notice. // // Copyright 2001 by Mike Hall. // See http…