Codigo:
Imports System.Text.RegularExpressions
Imports System.IO
Public Class Form1
Dim matrizesp As String() = {"Hola", "casa", "perro", "gato"}
Dim matrizing As String() = {"Hello", "home", "dog", "cat"}
Dim nuevoarray As String() = {}
Dim texto As String
Dim espacio As String = " "
Dim coma As String
Dim punto As String
Dim nuevodialogo As New Dialog1
Dim nuevoform As New Form2
Dim nuevoformu As New Form3
Dim cad As String
''' <summary>
''' Al cargar el formulario introducimos los items en el combobox
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
ComboBox1.Items.Add("Seleccione un idioma")
ComboBox1.Items.Add("Español")
ComboBox1.Items.Add("Ingles")
ComboBox1.SelectedIndex = 0
End Sub
Private Sub BotonTraducir_Click(sender As System.Object, e As System.EventArgs) Handles BotonTraducir.Click
Dim palabra As String = String.Format(TextBox1.Text)
If String.IsNullOrEmpty(TextBox1.Text) Then
MessageBox.Show("Debe introducir un texto para traducirlo")
TextBox1.Focus()
ElseIf ComboBox1.SelectedItem = "Seleccione un idioma" Then
MessageBox.Show("Debe elegir un idioma original")
ElseIf ComboBox1.SelectedItem = "Español" Then
texto = TextBox1.Text
corregir(texto)
If RadioButtonIng.Checked = True Then
For i As Integer = 0 To matrizesp.GetUpperBound(0)
If matrizesp(i) = cad Then
TextBox2.Text = matrizing(i)
Exit For
Else
TextBox2.Text = palabra
End If
Next
Else
MessageBox.Show("Debe elegir un idioma para traducir")
End If
ElseIf ComboBox1.SelectedItem = "Ingles" Then
texto = TextBox1.Text
corregir(texto)
If RadioButtonEsp.Checked = True Then
For i As Integer = 0 To matrizing.GetUpperBound(0)
If matrizing(i) = cad Then
TextBox2.Text = matrizesp(i)
Exit For
Else
TextBox2.Text = palabra
End If
Next
Else
MessageBox.Show("Debe elegir un idioma para traducir")
End If
End If
End Sub
Private Sub BotonSalir_Click(sender As System.Object, e As System.EventArgs) Handles BotonSalir.Click
Me.Close()
End Sub
Private Sub ComboBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
If ComboBox1.SelectedItem = "Seleccione un idioma" Then
RadioButtonEsp.Enabled = False
RadioButtonIng.Enabled = False
End If
If ComboBox1.SelectedItem = "Español" Then
RadioButtonEsp.Enabled = False
RadioButtonIng.Enabled = True
End If
RadioButtonIng.Checked = False
If ComboBox1.SelectedItem = "Ingles" Then
RadioButtonIng.Enabled = False
RadioButtonEsp.Enabled = True
End If
RadioButtonEsp.Checked = False
End Sub
Private Sub ButtonAñadir_Click(sender As System.Object, e As System.EventArgs) Handles ButtonAñadir.Click
nuevodialogo.ShowDialog()
End Sub
Private Sub ButtonVerGuardadas_Click(sender As System.Object, e As System.EventArgs) Handles ButtonVerGuardadas.Click
nuevoform.ShowDialog()
End Sub
Private Sub ButtonModificacion_Click(sender As System.Object, e As System.EventArgs) Handles ButtonModificacion.Click
nuevoformu.ShowDialog()
End Sub
Public Function corregir(cadena As String) As String
cad = TextBox1.Text
cad = Regex.Replace(cadena, "(.)\1{1,}", "$1")
Return cad
End Function
hay teneis el codigo de lo q tengo echo hasta ahora a ver si podeis ayudarme gracias