mi problema es el siguiente, como estoy recien en esto de programar en visual
nose como implementar mi ventana de ventas, nose como continuar la venta ya sea ingresando el monto, y siquiero volver hacias atras para agregar mas productos, sumar el total de los precio en el textbox de total, en fin muchas cosas de esta pantalla
luego apreto F9 y oculto el textbox y el label de abajo y pongo visible el texbox paara el monto.
sera lo correcto????? y como podria volver atrás???
me quedan pocos días :$
aqui el codigo de todo el form
Código vb:
Ver original
Imports System.Data.SqlClient Public Class VentaLibros Private myConn As New SqlConnection Private myCmd As New SqlCommand Dim myReader2 As SqlDataReader Private results As String Dim adaptor As New SqlClient.SqlDataAdapter Dim dataset As New DataSet Private Sub VentaLibros_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown If e.KeyValue = Keys.F1 Or Keys.F2 Or Keys.F3 Or Keys.F4 Or Keys.F5 Or Keys.F6 Or Keys.F7 Or Keys.F8 Or Keys.F9 Or Keys.F10 Or Keys.F11 Or Keys.F12 Or Keys.Escape Then FuncKeysModule(e.KeyValue) e.Handled = True End If End Sub Private Sub VentaLibros_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load TbMonto.Visible = False ingreseMonto.Visible = False End Sub Private Sub TbProducto_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TbProducto.KeyDown If e.KeyValue = Keys.F1 Or Keys.F2 Or Keys.F3 Or Keys.F4 Or Keys.F5 Or Keys.F6 Or Keys.F7 Or Keys.F8 Or Keys.F9 Or Keys.F10 Or Keys.F11 Or Keys.F12 Or Keys.Escape Then FuncKeysModule(e.KeyValue) e.Handled = True End If End Sub Private Sub TbProducto_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TbProducto.KeyPress 'Valido que se ingrese solo numeros If Char.IsNumber(e.KeyChar) Then e.Handled = False 'Valido que se presione Backspace,Enter ElseIf Char.IsControl(e.KeyChar) Then e.Handled = False 'Las demas teclas quedan bloqueadas Else e.Handled = True End If 'Si mando un ENTER entonces que busque If e.KeyChar = Convert.ToChar(Keys.Enter) Then myConn = New SqlConnection("Initial Catalog=libroteka;Data Source=localhost;Integrated Security=SSPI;") myCmd = myConn.CreateCommand myCmd.CommandText = "SELECT * FROM libros WHERE cod_libro ='" & TbProducto.Text & "' " adaptor.SelectCommand = myCmd adaptor.Fill(dataset, "0") Dim count = dataset.Tables(0).Rows.Count If count > 0 Then myConn.Open() With Ltver.Items.Add(TbProducto.Text, "cod_libro") .SubItems.Add(dataset.Tables(0).Rows(0).Item("nombre_libro")) .SubItems.Add(dataset.Tables(0).Rows(0).Item("precio")) End With End If End If TbProducto.Clear() dataset.Clear() myConn.Close() myConn.Close() End Sub Private Sub TbProducto_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TbProducto.TextChanged End Sub Private Sub Ltver_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Ltver.KeyDown If e.KeyValue = Keys.F1 Or Keys.F2 Or Keys.F3 Or Keys.F4 Or Keys.F5 Or Keys.F6 Or Keys.F7 Or Keys.F8 Or Keys.F9 Or Keys.F10 Or Keys.F11 Or Keys.F12 Or Keys.Escape Then FuncKeysModule(e.KeyValue) e.Handled = True End If End Sub Public Sub FuncKeysModule(ByVal value As Keys) 'Check what function key is in a pressed state, and then perform the corresponding action. Select Case value Case Keys.F1 'Add the code for the function key F1 here. MessageBox.Show("F1 pressed") Case Keys.F2 'Add the code for the function key F2 here. MessageBox.Show("F2 pressed") Case Keys.F3 'Add the code for the function key F3 here. MessageBox.Show("F3 pressed") Case Keys.F4 'Add the code for the function key F4 here. MessageBox.Show("F4 pressed") Case Keys.F5 'Add the code for the function key F5 here. MessageBox.Show("F5 pressed") Case Keys.F6 'Add the code for the function key F6 here. MessageBox.Show("F6 pressed") Case Keys.F7 'Add the code for the function key F7 here. MessageBox.Show("F7 pressed") Case Keys.F8 'Add the code for the function key F8 here. MessageBox.Show("F8 pressed") Case Keys.F9 TbProducto.Visible = False Label4.Visible = False TbMonto.Visible = True ingreseMonto.Visible = True Case Keys.F10 'Add the code for the function key F10 here. MessageBox.Show("F10 pressed") Case Keys.F11 'Add the code for the function key F11 here. MessageBox.Show("F11 pressed") Case Keys.F12 'Add the code for the key F12 here MessageBox.Show("F12 pressed") Case Keys.Escape MessageBox.Show("Escapate") End Select End Sub Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown If e.KeyValue = Keys.F1 Or Keys.F2 Or Keys.F3 Or Keys.F4 Or Keys.F5 Or Keys.F6 Or Keys.F7 Or Keys.F8 Or Keys.F9 Or Keys.F10 Or Keys.F11 Or Keys.F12 Then FuncKeysModule(e.KeyValue) e.Handled = True End If End Sub End Class