☹ no hay modo de hacerlo mediante linea de comandos en cmd por lo que deduzco.
Gracias
Gracias
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes MenúCita de: NEBIRE en 29 Diciembre 2018, 00:43 AM
Exacto, si...
Si el ordenador destino ha de ser fijo un windows 2000, hay que rehacerlo en vb6...
No obstante, no elimines el programa... si tarde o temprano, tienes que usarlo en un equipo más actual, pués ya lo tienes.
No. Son tecnologías distintas. En windows 2000 incluso es muy probable que no admita ningún framework más actual que el 1.1 o 2.0 de NET (no estoy seguro, habría que mirarlo).
Ya en el XP, la versión superior que admite es el NET 3.5
En fin, básicamente se puede rehacer con VB6, con cambios eso sí... La cuestión es si tienes un IDE de VB6...
Private Sub txtBillete50_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtBillete50.Validating
Dim v As UShort 'UInt16 entero de 16 bits (valor en el rango: 0-65536)
' si admite un valor negativo, cambia al tipo short (int16)
If UShort.TryParse(txtBillete50.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'billete de 50'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
'txtImporte50.Text ="0"
Else
txtImporte50.Text = (v * 50).ToString
End If
End Sub
Private Sub txtMonedas001_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TxtBillete001.Validating
Call ValidandoBiletesyMonedas(sender.text, TxtImporte001, 0.1, " 'monedas de 1 céntimo'.", e)
End Sub
Public Class Form1
Private Inicializado As Boolean
Private Sub txtBillete50_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtBillete50.TextChanged, txtBillete20.TextChanged, txtBillete10.TextChanged, txtBillete5.TextChanged, txtMonedas2.TextChanged, txtMonedas1.TextChanged, txtMonedas050.TextChanged, txtMonedas020.TextChanged, txtMonedas010.TextChanged, txtMonedas005.TextChanged, txtMonedas002.TextChanged, txtMonedas001.TextChanged
sender.backcolor = Color.White
txtTotal.Visible = True
End Sub
Private Sub txtBillete50_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtBillete50.Validated, txtBillete20.Validated, txtBillete10.Validated, txtBillete5.Validated, txtMonedas2.Validated, txtMonedas1.Validated, txtMonedas050.Validated, txtMonedas020.Validated, txtMonedas010.Validated, txtMonedas005.Validated, txtMonedas002.Validated, txtMonedas001.Validated
sender.backcolor = Color.White
txtTotal.Visible = True
End Sub
Private Sub txtBillete50_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtBillete50.Validating
Dim v As UShort 'UInt16 entero de 16 bits (valor en el rango: 0-65536)
' si admite un valor negativo, cambia al tipo short (int16)
If UShort.TryParse(txtBillete50.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'billete de 50'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
'txtImporte50.Text ="0"
Else
txtImporte50.Text = (v * 50).ToString
End If
End Sub
Private Sub txtBillete20_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtBillete20.Validating
Dim v As UShort
If UShort.TryParse(txtBillete20.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'billete de 20'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte20.Text = (v * 20).ToString
End If
End Sub
Private Sub txtBillete10_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtBillete10.Validating
Dim v As UShort
If UShort.TryParse(txtBillete10.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'billete de 10'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte10.Text = (v * 10).ToString
End If
End Sub
Private Sub txtBillete5_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtBillete5.Validating
Dim v As UShort
If UShort.TryParse(txtBillete5.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'billete de 5'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte5.Text = (v * 5).ToString
End If
End Sub
Private Sub txtMonedas2_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMonedas2.Validating
Dim v As UShort
If UShort.TryParse(txtMonedas2.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'monedas de 2'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte2.Text = (v * 2).ToString
End If
End Sub
Private Sub txtMonedas1_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMonedas1.Validating
Dim v As UShort
If UShort.TryParse(txtMonedas1.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'monedas de 1'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte1.Text = (v * 1).ToString
End If
End Sub
Private Sub txtMonedas050_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMonedas050.Validating
Dim v As UShort
If UShort.TryParse(txtMonedas050.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'monedas de 0.50'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte050.Text = (0.5 * v).ToString
End If
End Sub
Private Sub txtMonedas020_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMonedas020.Validating
Dim v As UShort
If UShort.TryParse(txtMonedas020.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'monedas de 0.20'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte020.Text = (0.2 * v).ToString
End If
End Sub
Private Sub txtMonedas010_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMonedas010.Validating
Dim v As UShort
If UShort.TryParse(txtMonedas010.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'monedas de 0.10'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte010.Text = (0.1 * v).ToString
End If
End Sub
Private Sub txtMonedas005_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMonedas005.Validating
Dim v As UShort
If UShort.TryParse(txtMonedas005.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'monedas de 0.05'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte005.Text = (0.05 * v).ToString
End If
End Sub
Private Sub txtMonedas002_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMonedas002.Validating
Dim v As UShort
If UShort.TryParse(txtMonedas002.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'monedas de 0.02'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte002.Text = (0.02 * v).ToString
End If
End Sub
Private Sub txtMonedas001_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMonedas001.Validating
Dim v As UShort
If UShort.TryParse(txtMonedas001.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'monedas de 0.01'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte001.Text = (0.01 * v).ToString
End If
End Sub
Private Sub Totalizar() Handles txtImporte50.TextChanged, txtImporte20.TextChanged, txtImporte10.TextChanged, txtImporte5.TextChanged, txtImporte2.TextChanged, txtImporte1.TextChanged, txtImporte050.TextChanged, txtImporte020.TextChanged, txtImporte010.TextChanged, txtImporte005.TextChanged, txtImporte002.TextChanged, txtImporte001.TextChanged
Dim CantidadTotal As Single ' entero de 32 bits...
If (Inicializado = True) Then
CantidadTotal = 0
CantidadTotal += Single.Parse(txtImporte50.Text)
CantidadTotal += Single.Parse(txtImporte20.Text)
CantidadTotal += Single.Parse(txtImporte10.Text)
CantidadTotal += Single.Parse(txtImporte5.Text)
CantidadTotal += Single.Parse(txtImporte2.Text)
CantidadTotal += Single.Parse(txtImporte1.Text)
CantidadTotal += Single.Parse(txtImporte050.Text)
CantidadTotal += Single.Parse(txtImporte020.Text)
CantidadTotal += Single.Parse(txtImporte010.Text)
CantidadTotal += Single.Parse(txtImporte005.Text)
CantidadTotal += Single.Parse(txtImporte002.Text)
CantidadTotal += Single.Parse(txtImporte001.Text)
txtTotal.Text = CantidadTotal.ToString
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Inicializado = True
End Sub
Private Sub txtBillete50_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtBillete50.KeyPress
If Asc(e.KeyChar) = 13 Then
txtBillete20.Focus()
e.Handled = True
End If
End Sub
Private Sub txtBillete20_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtBillete20.KeyPress
If Asc(e.KeyChar) = 13 Then
txtBillete10.Focus()
e.Handled = True
End If
End Sub
Private Sub txtBillete10_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtBillete10.KeyPress
If Asc(e.KeyChar) = 13 Then
txtBillete5.Focus()
e.Handled = True
End If
End Sub
Private Sub txtBillete5_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtBillete5.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMonedas2.Focus()
e.Handled = True
End If
End Sub
Private Sub txtMonedas2_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonedas2.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMonedas1.Focus()
e.Handled = True
End If
End Sub
Private Sub txtMonedas1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonedas1.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMonedas050.Focus()
e.Handled = True
End If
End Sub
Private Sub txtMonedas050_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonedas050.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMonedas020.Focus()
e.Handled = True
End If
End Sub
Private Sub txtMonedas020_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonedas020.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMonedas010.Focus()
e.Handled = True
End If
End Sub
Private Sub txtMonedas010_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonedas010.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMonedas005.Focus()
e.Handled = True
End If
End Sub
Private Sub txtMonedas005_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonedas005.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMonedas002.Focus()
e.Handled = True
End If
End Sub
Private Sub txtMonedas002_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonedas002.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMonedas001.Focus()
e.Handled = True
End If
End Sub
Private Sub txtMonedas001_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonedas001.KeyPress
If Asc(e.KeyChar) = 13 Then
txtTotal1.Focus()
e.Handled = True
End If
End Sub
End Class
Public Class Form1
Private Inicializado As Boolean
Private Sub txtBillete50_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtBillete50.TextChanged, txtBillete20.TextChanged, txtBillete10.TextChanged, txtBillete5.TextChanged, txtMonedas2.TextChanged, txtMonedas1.TextChanged, txtMonedas050.TextChanged, txtMonedas020.TextChanged, txtMonedas010.TextChanged, txtMonedas005.TextChanged, txtMonedas002.TextChanged, txtMonedas001.TextChanged
sender.backcolor = Color.White
txtTotal.Visible = True
End Sub
Private Sub txtBillete50_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtBillete50.Validated, txtBillete20.Validated, txtBillete10.Validated, txtBillete5.Validated, txtMonedas2.Validated, txtMonedas1.Validated, txtMonedas050.Validated, txtMonedas020.Validated, txtMonedas010.Validated, txtMonedas005.Validated, txtMonedas002.Validated, txtMonedas001.Validated
sender.backcolor = Color.White
txtTotal.Visible = True
End Sub
Private Sub txtBillete50_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtBillete50.Validating
Dim v As UShort 'UInt16 entero de 16 bits (valor en el rango: 0-65536)
' si admite un valor negativo, cambia al tipo short (int16)
If UShort.TryParse(txtBillete50.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'billete de 50'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
'txtImporte50.Text ="0"
Else
txtImporte50.Text = (v * 50).ToString
End If
End Sub
Private Sub txtBillete20_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtBillete20.Validating
Dim v As UShort
If UShort.TryParse(txtBillete20.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'billete de 20'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte20.Text = (v * 20).ToString
End If
End Sub
Private Sub txtBillete10_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtBillete10.Validating
Dim v As UShort
If UShort.TryParse(txtBillete10.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'billete de 10'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte10.Text = (v * 10).ToString
End If
End Sub
Private Sub txtBillete5_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtBillete5.Validating
Dim v As UShort
If UShort.TryParse(txtBillete5.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'billete de 5'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte5.Text = (v * 5).ToString
End If
End Sub
Private Sub txtMonedas2_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMonedas2.Validating
Dim v As UShort
If UShort.TryParse(txtMonedas2.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'monedas de 2'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte2.Text = (v * 2).ToString
End If
End Sub
Private Sub txtMonedas1_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMonedas1.Validating
Dim v As UShort
If UShort.TryParse(txtMonedas1.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'monedas de 1'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte1.Text = (v * 1).ToString
End If
End Sub
Private Sub txtMonedas050_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMonedas050.Validating
Dim v As UShort
If UShort.TryParse(txtMonedas050.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'monedas de 0.50'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte050.Text = (0.5 * v).ToString
End If
End Sub
Private Sub txtMonedas020_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMonedas020.Validating
Dim v As UShort
If UShort.TryParse(txtMonedas020.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'monedas de 0.20'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte020.Text = (0.2 * v).ToString
End If
End Sub
Private Sub txtMonedas010_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMonedas010.Validating
Dim v As UShort
If UShort.TryParse(txtMonedas010.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'monedas de 0.10'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte010.Text = (0.1 * v).ToString
End If
End Sub
Private Sub txtMonedas005_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMonedas005.Validating
Dim v As UShort
If UShort.TryParse(txtMonedas005.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'monedas de 0.05'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte005.Text = (0.05 * v).ToString
End If
End Sub
Private Sub txtMonedas002_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMonedas002.Validating
Dim v As UShort
If UShort.TryParse(txtMonedas002.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'monedas de 0.02'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte002.Text = (0.02 * v).ToString
End If
End Sub
Private Sub txtMonedas001_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMonedas001.Validating
Dim v As UShort
If UShort.TryParse(txtMonedas001.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'monedas de 0.01'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte001.Text = (0.01 * v).ToString
End If
End Sub
Private Sub Totalizar() Handles txtBillete50.TextChanged, txtBillete20.TextChanged, txtBillete10.TextChanged, txtBillete5.TextChanged, txtMonedas2.TextChanged, txtMonedas1.TextChanged, txtMonedas050.TextChanged, txtMonedas020.TextChanged, txtMonedas010.TextChanged, txtMonedas005.TextChanged, txtMonedas002.TextChanged, txtMonedas001.TextChanged
Dim CantidadTotal As Single ' entero de 32 bits...
If (Inicializado = True) Then
CantidadTotal = 0
CantidadTotal += Single.Parse(txtImporte50.Text)
CantidadTotal += Single.Parse(txtImporte20.Text)
CantidadTotal += Single.Parse(txtImporte10.Text)
CantidadTotal += Single.Parse(txtImporte5.Text)
CantidadTotal += Single.Parse(txtImporte2.Text)
CantidadTotal += Single.Parse(txtImporte1.Text)
CantidadTotal += Single.Parse(txtImporte050.Text)
CantidadTotal += Single.Parse(txtImporte020.Text)
CantidadTotal += Single.Parse(txtImporte010.Text)
CantidadTotal += Single.Parse(txtImporte005.Text)
CantidadTotal += Single.Parse(txtImporte002.Text)
CantidadTotal += Single.Parse(txtImporte001.Text)
txtTotal.Text = CantidadTotal.ToString
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Inicializado = True
End Sub
Private Sub txtBillete50_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtBillete50.KeyPress
If Asc(e.KeyChar) = 13 Then
txtBillete20.Focus()
e.Handled = True
End If
End Sub
Private Sub txtBillete20_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtBillete20.KeyPress
If Asc(e.KeyChar) = 13 Then
txtBillete10.Focus()
e.Handled = True
End If
End Sub
Private Sub txtBillete10_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtBillete10.KeyPress
If Asc(e.KeyChar) = 13 Then
txtBillete5.Focus()
e.Handled = True
End If
End Sub
Private Sub txtBillete5_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtBillete5.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMonedas2.Focus()
e.Handled = True
End If
End Sub
Private Sub txtMonedas2_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonedas2.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMonedas1.Focus()
e.Handled = True
End If
End Sub
Private Sub txtMonedas1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonedas1.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMonedas050.Focus()
e.Handled = True
End If
End Sub
Private Sub txtMonedas050_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonedas050.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMonedas020.Focus()
e.Handled = True
End If
End Sub
Private Sub txtMonedas020_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonedas020.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMonedas010.Focus()
e.Handled = True
End If
End Sub
Private Sub txtMonedas010_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonedas010.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMonedas005.Focus()
e.Handled = True
End If
End Sub
Private Sub txtMonedas005_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonedas005.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMonedas002.Focus()
e.Handled = True
End If
End Sub
Private Sub txtMonedas002_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonedas002.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMonedas001.Focus()
e.Handled = True
End If
End Sub
Private Sub txtMonedas001_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonedas001.KeyPress
If Asc(e.KeyChar) = 13 Then
txtTotal1.Focus()
e.Handled = True
End If
End Sub
Private Sub Totalizar(sender As Object, e As EventArgs) Handles txtBillete50.TextChanged, txtBillete20.TextChanged, txtBillete10.TextChanged, txtBillete5.TextChanged, txtMonedas2.TextChanged, txtMonedas1.TextChanged, txtMonedas050.TextChanged, txtMonedas020.TextChanged, txtMonedas010.TextChanged, txtMonedas005.TextChanged, txtMonedas002.TextChanged, txtMonedas001.TextChanged
End Sub
End Class
Public Class Form1
Private Inicializado As Boolean
Private Sub txtBillete50_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtBillete50.TextChanged, txtBillete20.TextChanged, txtBillete10.TextChanged, txtBillete5.TextChanged, txtMonedas2.TextChanged, txtMonedas1.TextChanged, txtMonedas050.TextChanged, txtMonedas020.TextChanged, txtMonedas010.TextChanged, txtMonedas005.TextChanged, txtMonedas002.TextChanged, txtMonedas001.TextChanged
sender.backcolor = Color.White
txtTotal.Visible = True
End Sub
Private Sub txtBillete50_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtBillete50.Validated, txtBillete20.Validated, txtBillete10.Validated, txtBillete5.Validated, txtMonedas2.Validated, txtMonedas1.Validated, txtMonedas050.Validated, txtMonedas020.Validated, txtMonedas010.Validated, txtMonedas005.Validated, txtMonedas002.Validated, txtMonedas001.Validated
sender.backcolor = Color.White
txtTotal.Visible = True
End Sub
Private Sub txtBillete50_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtBillete50.Validating
Dim v As UShort 'UInt16 entero de 16 bits (valor en el rango: 0-65536)
' si admite un valor negativo, cambia al tipo short (int16)
If UShort.TryParse(txtBillete50.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'billete de 50'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
'txtImporte50.Text ="0"
Else
txtImporte50.Text = (v * 50).ToString
End If
End Sub
Private Sub txtBillete20_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtBillete20.Validating
Dim v As UShort
If UShort.TryParse(txtBillete20.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'billete de 20'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte20.Text = (v * 20).ToString
End If
End Sub
Private Sub txtBillete10_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtBillete10.Validating
Dim v As UShort
If UShort.TryParse(txtBillete10.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'billete de 10'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte10.Text = (v * 10).ToString
End If
End Sub
Private Sub txtBillete5_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtBillete5.Validating
Dim v As UShort
If UShort.TryParse(txtBillete5.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'billete de 5'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte5.Text = (v * 5).ToString
End If
End Sub
Private Sub txtMonedas2_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMonedas2.Validating
Dim v As UShort
If UShort.TryParse(txtMonedas2.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'monedas de 2'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte2.Text = (v * 2).ToString
End If
End Sub
Private Sub txtMonedas1_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMonedas1.Validating
Dim v As UShort
If UShort.TryParse(txtMonedas1.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'monedas de 1'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte1.Text = (v * 1).ToString
End If
End Sub
Private Sub txtMonedas050_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMonedas050.Validating
Dim v As Single
If Single.TryParse(txtMonedas050.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'monedas de 0.50'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte050.Text = (v * 0.5).ToString
End If
End Sub
Private Sub txtMonedas020_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMonedas020.Validating
Dim v As Single
If Single.TryParse(txtMonedas020.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'monedas de 0.20'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte020.Text = (v * 0.2).ToString
End If
End Sub
Private Sub txtMonedas010_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMonedas010.Validating
Dim v As Single
If Single.TryParse(txtMonedas010.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'monedas de 0.10'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte010.Text = (v * 0.1).ToString
End If
End Sub
Private Sub txtMonedas005_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMonedas005.Validating
Dim v As Single
If Single.TryParse(txtMonedas005.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'monedas de 0.05'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte005.Text = (v * 0.05).ToString
End If
End Sub
Private Sub txtMonedas002_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMonedas002.Validating
Dim v As Single
If Single.TryParse(txtMonedas002.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'monedas de 0.02'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte002.Text = (v * 0.02).ToString
End If
End Sub
Private Sub txtMonedas001_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMonedas001.Validating
Dim v As Single
If Single.TryParse(txtMonedas001.Text, v) = False Then
e.Cancel = True
Call MessageBox.Show("No puede tomarse como un numero el valor para 'monedas de 0.01'.", "Error: No es un numero.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
txtImporte001.Text = (v * 0.01).ToString
End If
End Sub
Private Sub Totalizar() Handles txtImporte50.TextChanged, txtImporte20.TextChanged, txtImporte10.TextChanged
Dim CantidadTotal As Single ' entero de 32 bits...
If (Inicializado = True) Then
CantidadTotal = 0
CantidadTotal += Single.Parse(txtImporte50.Text)
CantidadTotal += Single.Parse(txtImporte20.Text)
CantidadTotal += Single.Parse(txtImporte10.Text)
CantidadTotal += Single.Parse(txtImporte5.Text)
CantidadTotal += Single.Parse(txtImporte2.Text)
CantidadTotal += Single.Parse(txtImporte1.Text)
CantidadTotal += Single.Parse(txtImporte050.Text)
CantidadTotal += Single.Parse(txtImporte020.Text)
CantidadTotal += Single.Parse(txtImporte010.Text)
CantidadTotal += Single.Parse(txtImporte005.Text)
CantidadTotal += Single.Parse(txtImporte002.Text)
CantidadTotal += Single.Parse(txtImporte001.Text)
txtTotal.Text = CantidadTotal.ToString
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Inicializado = True
End Sub
Private Sub txtBillete50_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtBillete50.KeyPress
If Asc(e.KeyChar) = 13 Then
txtBillete20.Focus()
e.Handled = True
End If
End Sub
Private Sub txtBillete20_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtBillete20.KeyPress
If Asc(e.KeyChar) = 13 Then
txtBillete10.Focus()
e.Handled = True
End If
End Sub
Private Sub txtBillete10_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtBillete10.KeyPress
If Asc(e.KeyChar) = 13 Then
txtBillete5.Focus()
e.Handled = True
End If
End Sub
Private Sub txtBillete5_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtBillete5.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMonedas2.Focus()
e.Handled = True
End If
End Sub
Private Sub txtMonedas2_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonedas2.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMonedas1.Focus()
e.Handled = True
End If
End Sub
Private Sub txtMonedas1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonedas1.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMonedas050.Focus()
e.Handled = True
End If
End Sub
Private Sub txtMonedas050_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonedas050.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMonedas020.Focus()
e.Handled = True
End If
End Sub
Private Sub txtMonedas020_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonedas020.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMonedas010.Focus()
e.Handled = True
End If
End Sub
Private Sub txtMonedas010_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonedas010.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMonedas005.Focus()
e.Handled = True
End If
End Sub
Private Sub txtMonedas005_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonedas005.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMonedas002.Focus()
e.Handled = True
End If
End Sub
Private Sub txtMonedas002_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonedas002.KeyPress
If Asc(e.KeyChar) = 13 Then
txtMonedas001.Focus()
e.Handled = True
End If
End Sub
Private Sub txtMonedas001_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonedas001.KeyPress
If Asc(e.KeyChar) = 13 Then
txtTotal1.Focus()
e.Handled = True
End If
End Sub
Private Sub Totalizar(sender As Object, e As EventArgs) Handles txtImporte50.TextChanged, txtImporte20.TextChanged, txtImporte10.TextChanged
End Sub
End Class