Вы находитесь на странице: 1из 5

DICCIONARIO.

Este diccionario ha sido bajado de internet , se ha hecho el


program en visual basic modo consola y modo formulario

Imports System.IO
Module Module1
Public A(25000, 2) As String
Public nf As Integer
Sub LeerArchivo(A(,) As String, ByRef nf As Integer)
Dim srLector As StreamReader = New StreamReader("e:\DATOS\DIC1.txt")
Dim Linea As String
Dim cont As Integer = 0
Dim pos As Integer

Linea = srLector.ReadLine()
Do While Not (Linea Is Nothing)
pos = InStr(1, Linea, Chr(9))
A(cont, 0) = Mid(Linea, 1, pos - 1)
A(cont, 1) = Mid(Linea, pos + 1, Len(Linea))
cont = cont + 1
Linea = srLector.ReadLine()
Loop
nf = cont
End Sub
Sub BuscarInglesCastellano(A(,) As String, Ingles As String, nf As Integer)
Dim i As Integer
Dim largo As Integer
Dim cont1 As Integer = 0
For i = 0 To nf - 1
largo = InStr(A(i, 0), Ingles)
If largo > 0 Then
Console.WriteLine(" {0}===> {1} ====>{2}", cont1, A(i, 0), A(i, 1))
cont1 = cont1 + 1
End If
Next
Console.WriteLine("Palabras encontradas{0}", cont1)
End Sub
Sub BuscarCastellanoIngles(A(,) As String, Castellano As String, nf As Integer)
Dim i As Integer
Dim largo As Integer
Dim cont1 As Integer = 0
For i = 0 To nf - 1
largo = InStr(A(i, 1), Castellano)
If largo > 0 Then
Console.WriteLine(" {0}===> {1} ====>{2}", cont1, A(i, 1), A(i, 0))
cont1 = cont1 + 1
End If
Next
Console.WriteLine("Palabras encontradas{0}", cont1)
End Sub
Sub Main()
LeerArchivo(A, nf)
Dim opcion As Integer
Dim Ingles, Castellano As String
Do
Console.WriteLine("1. Ingles castellano 2. Castellano Ingles 3.Salir ")
Console.Write("ingrese opcion ")
opcion = Console.ReadLine()
Select Case opcion
Case 1

Console.WriteLine("Ingrese palabra en Ingls ")


Ingles = Console.ReadLine
BuscarInglesCastellano(A, Ingles, nf)
Case 2
Console.WriteLine("Ingrese palabra en Castellano ")
Castellano = Console.ReadLine
BuscarCastellanoIngles(A, Castellano, nf)
End Select
Loop While opcion <> 3
End Sub
End Module
ELABORAR MENU Y BARRA DE HERRAMIENTAS CON EL CONTROL
RICHTEXTBOX
Revisar el capitulo 13 windows form 14 del libro de visual basic 2015

Public Class Form1


Dim Color As Color
Dim Pos As Integer
Dim pos1 As Integer = 1
Dim posini As Integer = 1
Dim tipo As Integer = 1

Private Sub MnuBorrar_Click(sender As Object, e As EventArgs) Handles


MnuBorrar.Click
RichTextBox1.Clear()
End Sub
Private Sub MnuSalir_Click(sender As Object, e As EventArgs) Handles
MnuSalir.Click
Me.Close()
End Sub
Private Sub MnuOpen_Click(sender As Object, e As EventArgs) Handles
MnuOpen.Click
OpenFileDialog1.Title = "Abrir Documento rtf"
OpenFileDialog1.Filter = "Documento rtf|*.rtf"
OpenFileDialog1.ShowDialog()
RichTextBox1.LoadFile(OpenFileDialog1.FileName,
RichTextBoxStreamType.RichText)
End Sub
Private Sub MnuGrabar_Click(sender As Object, e As EventArgs) Handles
MnuGrabar.Click
With SaveFileDialog1 'Dialogo de Guardar
.Title = "Guardar Documento rtf"
.Filter = "Documento rtf|*.rtf"
If .ShowDialog = DialogResult.OK Then
RichTextBox1.SaveFile(.FileName, RichTextBoxStreamType.RichText)
End If
End With
End Sub
Private Sub MnuColorDeTexto_Click(sender As Object, e As EventArgs)
Handles MnuColorLetra.Click
ColorDialog1.ShowDialog()
Color = ColorDialog1.Color
RichTextBox1.SelectionColor = Color ' El color que quieras
End Sub
Private Sub MnuColorDeTexto_Click_1(sender As Object, e As EventArgs)
Handles MnuFuente.Click
FontDialog1.ShowDialog()
RichTextBox1.SelectionFont = FontDialog1.Font
End Sub
Private Sub mnuBuscar_Click(sender As Object, e As EventArgs) Handles
mnuBuscar.Click
Dim cadBusca As String
cadBusca = InputBox("ingrese texto a buscar", "buscador", "")
Pos = InStr(pos1, RichTextBox1.Text, cadBusca)

If Pos > 0 Then


RichTextBox1.Select(Pos - 1, Len(cadBusca))
RichTextBox1.SelectionColor = Color.Red
pos1 = Pos + Len(cadBusca)
Else
MsgBox(" Ya no hay conicidencias ")
pos1 = 1
End If
End Sub
Private Sub ReemplazarToolStripMenuItem_Click(sender As Object, e As
EventArgs) Handles ReemplazarToolStripMenuItem.Click
Dim cadbusca As String
Dim cadReempla As String
cadbusca = InputBox("ingrese texto a buscar", "buscador", "")
cadReempla = InputBox("ingrese texto a buscar", "reemplazador", "")
RichTextBox1.Text = Replace(RichTextBox1.Text, cadbusca, cadReempla)
End Sub
Private Sub CopyToolStripMenuItem_Click(sender As Object, e As EventArgs)
Handles mNUCopiar.Click
If RichTextBox1.SelectedText <> "" Then
Clipboard.SetDataObject(RichTextBox1.SelectedText)
End Sub
Private Sub mnuCortar_Click(sender As Object, e As EventArgs) Handles
mnuCortar.Click
If RichTextBox1.SelectedText <> "" Then
Clipboard.SetDataObject(RichTextBox1.SelectedText)
RichTextBox1.SelectedText = ""
End If
End Sub
Private Sub MnuPegar_Click(sender As Object, e As EventArgs) Handles
MnuPegar.Click
RichTextBox1.SelectedText = Clipboard.GetDataObject.GetData("Text")
End Sub
End Class

Вам также может понравиться