Beruflich Dokumente
Kultur Dokumente
Vb conexión
Imports System.Data.SqlClient
End Class
Vb vcategoria
Imports System.Data.SqlClient
Public Class fcategoria
Inherits conexion
Dim cmd As New SqlCommand
If cmd.ExecuteNonQuery Then
Dim dt As New DataTable
Dim da As New SqlDataAdapter(cmd)
da.Fill(dt)
Return dt
Else
Return Nothing
End If
Catch ex As Exception
MsgBox(ex.Message)
Return Nothing
Finally
desconectado()
End Try
End Function
If cmd.ExecuteNonQuery Then
Return True
Else
Return False
End If
Catch ex As Exception
MsgBox(ex.Message)
Return False
Finally
desconectado()
End Try
End Function
If cmd.ExecuteNonQuery Then
Return True
Else
Return False
End If
Catch ex As Exception
MsgBox(ex.Message)
Return False
Finally
desconectado()
End Try
End Function
If cmd.ExecuteNonQuery Then
Return True
Else
Return False
End If
Catch ex As Exception
MsgBox(ex.Message)
Return False
End Try
End Function
End Class
VB fc cliente
Imports System.Data.SqlClient
Public Class fcliente
Inherits conexion
Dim cmd As New SqlCommand
If cmd.ExecuteNonQuery Then
Dim dt As New DataTable
Dim da As New SqlDataAdapter(cmd)
da.Fill(dt)
Return dt
Else
Return Nothing
End If
Catch ex As Exception
MsgBox(ex.Message)
Return Nothing
Finally
desconectado()
End Try
End Function
If cmd.ExecuteNonQuery Then
Return True
Else
Return False
End If
Catch ex As Exception
MsgBox(ex.Message)
Return False
End Try
End Function
End Class
Fcproducto
Imports System.Data.SqlClient
If cmd.ExecuteNonQuery Then
Dim dt As New DataTable
Dim da As New SqlDataAdapter(cmd)
da.Fill(dt)
Return dt
Else
Return Nothing
End If
Catch ex As Exception
MsgBox(ex.Message)
Return Nothing
Finally
desconectado()
End Try
End Function
If cmd.ExecuteNonQuery Then
Return True
Else
Return False
End If
Catch ex As Exception
MsgBox(ex.Message)
Return False
Finally
desconectado()
End Try
End Function
If cmd.ExecuteNonQuery Then
Return True
Else
Return False
End If
Catch ex As Exception
MsgBox(ex.Message)
Return False
End Try
End Function
End Class
Categoría
Public Class vcategoria
Dim idcategoria As Integer
Dim nombre_Categoria As String
End Class
Fr
Public Class frmcategoria
Private dt As New DataTable
buscar()
End Sub
dv.RowFilter = cbocampo.Text & " like '" & txtbuscar.Text & "%'"
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Sub
Catch ex As Exception
MsgBox(ex.Message)
End Try
Else
MessageBox.Show("Falta ingresar algunos datos", "Guardando
registros", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End Sub
Private Sub datalistado_CellClick(sender As Object, e As
DataGridViewCellEventArgs) Handles datalistado.CellClick
txtidcategoria.Text = datalistado.SelectedCells.Item(1).Value
txtnombre.Text = datalistado.SelectedCells.Item(2).Value
btneditar.Visible = True
btnguardar.Visible = False
End Sub
dts.gidcategoria = txtidcategoria.Text
dts.gnombre_categoria = txtnombre.Text
If func.editar(dts) Then
MessageBox.Show("Categoria modificada correctamente",
"Modificando registros", MessageBoxButtons.OK, MessageBoxIcon.Information)
mostrar()
limpiar()
Else
MessageBox.Show("Categoria no fue modificada, intente de
nuevo", "Modificando registros", MessageBoxButtons.OK, MessageBoxIcon.Error)
mostrar()
limpiar()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
Else
MessageBox.Show("Falta ingresar algunos datos", "Modificando
registros", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End If
End Sub
End Sub
buscar()
End Sub
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Sub
dts.gnombres = txtnombre.Text
dts.gapellidos = txtapellidos.Text
dts.gdireccion = txtdireccion.Text
dts.gdni = txtdni.Text
dts.gtelefono = txttelefono.Text
If func.insertar(dts) Then
MessageBox.Show("Cliente registrado correctamente",
"Guardando registros", MessageBoxButtons.OK, MessageBoxIcon.Information)
mostrar()
limpiar()
Else
MessageBox.Show("Cliente no registrado, intente de nuevo",
"Guardando registros", MessageBoxButtons.OK, MessageBoxIcon.Error)
mostrar()
limpiar()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
Else
MessageBox.Show("Falta ingresar algunos datos", "Guardando
registros", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End Sub
End Sub
dts.gidcliente = txtidcliente.Text
dts.gnombres = txtnombre.Text
dts.gapellidos = txtapellidos.Text
dts.gdireccion = txtdireccion.Text
dts.gdni = txtdni.Text
dts.gtelefono = txttelefono.Text
If func.editar(dts) Then
MessageBox.Show("Cliente modificado correctamente",
"Modificando registros", MessageBoxButtons.OK, MessageBoxIcon.Information)
mostrar()
limpiar()
Else
MessageBox.Show("Cliente no modificado, intente de
nuevo", "Modificando registros", MessageBoxButtons.OK, MessageBoxIcon.Error)
mostrar()
limpiar()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
Else
MessageBox.Show("Falta ingresar algunos datos", "Modificando
registros", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End If
End Sub
End Sub
Frmproducto
Public Class frmproducto
imagen.Image = Nothing
imagen.BackgroundImage = My.Resources.imagentrans
imagen.SizeMode = PictureBoxSizeMode.StretchImage
End Sub
buscar()
End Sub
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Sub
dts.gnombre = txtnombre.Text
dts.gidcategoria = txtidcategoria.Text
dts.gdescripcion = txtdescripcion.Text
dts.gstock = txtstock.Text
dts.gprecio_compra = txtprecio_compra.Text
dts.gprecio_venta = txtprecio_venta.Text
dts.gfecha_vencimiento = txtfecha_vencimiento.Text
If func.insertar(dts) Then
MessageBox.Show("Producto registrado correctamente",
"Guardando registros", MessageBoxButtons.OK, MessageBoxIcon.Information)
mostrar()
limpiar()
Else
MessageBox.Show("Producto no fue registrado, intente de
nuevo", "Guardando registros", MessageBoxButtons.OK, MessageBoxIcon.Error)
mostrar()
limpiar()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
Else
MessageBox.Show("Falta ingresar algunos datos", "Guardando
registros", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End Sub
imagen.BackgroundImage = Nothing
Dim b() As Byte = datalistado.SelectedCells.Item(10).Value
Dim ms As New IO.MemoryStream(b)
imagen.Image = Image.FromStream(ms)
imagen.SizeMode = PictureBoxSizeMode.StretchImage
btneditar.Visible = True
btnguardar.Visible = False
End Sub
dts.gidproducto = txtidproducto.Text
dts.gnombre = txtnombre.Text
dts.gidcategoria = txtidcategoria.Text
dts.gdescripcion = txtdescripcion.Text
dts.gstock = txtstock.Text
dts.gprecio_compra = txtprecio_compra.Text
dts.gprecio_venta = txtprecio_venta.Text
dts.gfecha_vencimiento = txtfecha_vencimiento.Text
If func.editar(dts) Then
MessageBox.Show("Producto modificado correctamente",
"Modificando registros", MessageBoxButtons.OK, MessageBoxIcon.Information)
mostrar()
limpiar()
Else
MessageBox.Show("Producto no fue modificado, intente de
nuevo", "Modificando registros", MessageBoxButtons.OK, MessageBoxIcon.Error)
mostrar()
limpiar()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
Else
MessageBox.Show("Falta ingresar algunos datos", "Modificando
registros", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End If
End Sub
End Sub
End Sub
End Clas