Permalink
Browse files

Botones de barrita funcionando en analisis

  • Loading branch information...
1 parent dd62f9a commit 8a95345f2627463277bdbf554f5245213ec0263d @malopez committed Apr 21, 2012
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -32,7 +32,7 @@ Partial Class frmOperacionesAnalisis
Me.lblNRAnalisis = New System.Windows.Forms.Label()
Me.btnHaciaAtras = New System.Windows.Forms.Button()
Me.btnInicio = New System.Windows.Forms.Button()
- Me.txtBuscaAnalisis = New System.Windows.Forms.Button()
+ Me.btnBuscaAnalisis = New System.Windows.Forms.Button()
Me.Label2 = New System.Windows.Forms.Label()
Me.Label1 = New System.Windows.Forms.Label()
Me.txtNombreAnalisis = New System.Windows.Forms.TextBox()
@@ -41,22 +41,25 @@ Partial Class frmOperacionesAnalisis
Me.btnCancelarAnalisis = New System.Windows.Forms.Button()
Me.Panel2 = New System.Windows.Forms.Panel()
Me.Panel1 = New System.Windows.Forms.Panel()
+ Me.btnEditarAnalisis = New System.Windows.Forms.Button()
Me.Panel2.SuspendLayout()
+ Me.Panel1.SuspendLayout()
Me.SuspendLayout()
'
'btnGuardaAnalisis
'
+ Me.btnGuardaAnalisis.Enabled = False
Me.btnGuardaAnalisis.Image = CType(resources.GetObject("btnGuardaAnalisis.Image"), System.Drawing.Image)
- Me.btnGuardaAnalisis.Location = New System.Drawing.Point(498, 146)
+ Me.btnGuardaAnalisis.Location = New System.Drawing.Point(539, 144)
Me.btnGuardaAnalisis.Name = "btnGuardaAnalisis"
- Me.btnGuardaAnalisis.Size = New System.Drawing.Size(37, 23)
+ Me.btnGuardaAnalisis.Size = New System.Drawing.Size(38, 23)
Me.btnGuardaAnalisis.TabIndex = 65
Me.btnGuardaAnalisis.UseVisualStyleBackColor = True
'
'btnUpdAnalisis
'
Me.btnUpdAnalisis.Image = CType(resources.GetObject("btnUpdAnalisis.Image"), System.Drawing.Image)
- Me.btnUpdAnalisis.Location = New System.Drawing.Point(455, 146)
+ Me.btnUpdAnalisis.Location = New System.Drawing.Point(497, 144)
Me.btnUpdAnalisis.Name = "btnUpdAnalisis"
Me.btnUpdAnalisis.Size = New System.Drawing.Size(37, 23)
Me.btnUpdAnalisis.TabIndex = 66
@@ -65,9 +68,9 @@ Partial Class frmOperacionesAnalisis
'btnDelAnalisis
'
Me.btnDelAnalisis.Image = CType(resources.GetObject("btnDelAnalisis.Image"), System.Drawing.Image)
- Me.btnDelAnalisis.Location = New System.Drawing.Point(541, 146)
+ Me.btnDelAnalisis.Location = New System.Drawing.Point(582, 144)
Me.btnDelAnalisis.Name = "btnDelAnalisis"
- Me.btnDelAnalisis.Size = New System.Drawing.Size(37, 23)
+ Me.btnDelAnalisis.Size = New System.Drawing.Size(38, 23)
Me.btnDelAnalisis.TabIndex = 69
Me.btnDelAnalisis.UseVisualStyleBackColor = True
'
@@ -132,16 +135,16 @@ Partial Class frmOperacionesAnalisis
Me.btnInicio.Text = "<<"
Me.btnInicio.UseVisualStyleBackColor = True
'
- 'txtBuscaAnalisis
+ 'btnBuscaAnalisis
'
- Me.txtBuscaAnalisis.Font = New System.Drawing.Font("Century Gothic", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
- Me.txtBuscaAnalisis.ForeColor = System.Drawing.Color.SteelBlue
- Me.txtBuscaAnalisis.Image = CType(resources.GetObject("txtBuscaAnalisis.Image"), System.Drawing.Image)
- Me.txtBuscaAnalisis.Location = New System.Drawing.Point(321, 54)
- Me.txtBuscaAnalisis.Name = "txtBuscaAnalisis"
- Me.txtBuscaAnalisis.Size = New System.Drawing.Size(48, 23)
- Me.txtBuscaAnalisis.TabIndex = 58
- Me.txtBuscaAnalisis.UseVisualStyleBackColor = True
+ Me.btnBuscaAnalisis.Font = New System.Drawing.Font("Century Gothic", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnBuscaAnalisis.ForeColor = System.Drawing.Color.SteelBlue
+ Me.btnBuscaAnalisis.Image = CType(resources.GetObject("btnBuscaAnalisis.Image"), System.Drawing.Image)
+ Me.btnBuscaAnalisis.Location = New System.Drawing.Point(321, 54)
+ Me.btnBuscaAnalisis.Name = "btnBuscaAnalisis"
+ Me.btnBuscaAnalisis.Size = New System.Drawing.Size(48, 23)
+ Me.btnBuscaAnalisis.TabIndex = 58
+ Me.btnBuscaAnalisis.UseVisualStyleBackColor = True
'
'Label2
'
@@ -222,26 +225,36 @@ Partial Class frmOperacionesAnalisis
'Panel1
'
Me.Panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
+ Me.Panel1.Controls.Add(Me.btnUpdAnalisis)
+ Me.Panel1.Controls.Add(Me.btnGuardaAnalisis)
+ Me.Panel1.Controls.Add(Me.btnEditarAnalisis)
+ Me.Panel1.Controls.Add(Me.btnDelAnalisis)
Me.Panel1.Location = New System.Drawing.Point(0, 0)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(724, 223)
Me.Panel1.TabIndex = 72
'
+ 'btnEditarAnalisis
+ '
+ Me.btnEditarAnalisis.Image = CType(resources.GetObject("btnEditarAnalisis.Image"), System.Drawing.Image)
+ Me.btnEditarAnalisis.Location = New System.Drawing.Point(453, 144)
+ Me.btnEditarAnalisis.Name = "btnEditarAnalisis"
+ Me.btnEditarAnalisis.Size = New System.Drawing.Size(38, 23)
+ Me.btnEditarAnalisis.TabIndex = 74
+ Me.btnEditarAnalisis.UseVisualStyleBackColor = True
+ '
'frmOperacionesAnalisis
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(726, 262)
- Me.Controls.Add(Me.btnGuardaAnalisis)
- Me.Controls.Add(Me.btnUpdAnalisis)
- Me.Controls.Add(Me.btnDelAnalisis)
Me.Controls.Add(Me.btnInsAnalisis)
Me.Controls.Add(Me.btnFin)
Me.Controls.Add(Me.btnHaciaAdelante)
Me.Controls.Add(Me.lblNRAnalisis)
Me.Controls.Add(Me.btnHaciaAtras)
Me.Controls.Add(Me.btnInicio)
- Me.Controls.Add(Me.txtBuscaAnalisis)
+ Me.Controls.Add(Me.btnBuscaAnalisis)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.txtNombreAnalisis)
@@ -253,6 +266,7 @@ Partial Class frmOperacionesAnalisis
Me.Text = "Operaciones sobre análisis"
Me.Panel2.ResumeLayout(False)
Me.Panel2.PerformLayout()
+ Me.Panel1.ResumeLayout(False)
Me.ResumeLayout(False)
Me.PerformLayout()
@@ -266,7 +280,7 @@ Partial Class frmOperacionesAnalisis
Friend WithEvents lblNRAnalisis As System.Windows.Forms.Label
Friend WithEvents btnHaciaAtras As System.Windows.Forms.Button
Friend WithEvents btnInicio As System.Windows.Forms.Button
- Friend WithEvents txtBuscaAnalisis As System.Windows.Forms.Button
+ Friend WithEvents btnBuscaAnalisis As System.Windows.Forms.Button
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents txtNombreAnalisis As System.Windows.Forms.TextBox
@@ -275,4 +289,5 @@ Partial Class frmOperacionesAnalisis
Friend WithEvents btnCancelarAnalisis As System.Windows.Forms.Button
Friend WithEvents Panel2 As System.Windows.Forms.Panel
Friend WithEvents Panel1 As System.Windows.Forms.Panel
+ Friend WithEvents btnEditarAnalisis As System.Windows.Forms.Button
End Class
@@ -183,7 +183,7 @@
AsuywZQYWoynmsqxXLqRrdcaWKPWyDZQrdNST40eBTMxFP4M/gLKR6BBrjd1iQAAAABJRU5ErkJggg==
</value>
</data>
- <data name="txtBuscaAnalisis.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <data name="btnBuscaAnalisis.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADrwAAA68AZW8ckkAAAJySURBVDhPjZLfT1JhGMcJ1wU6FupcF46/IGtjzYvmzAsu
@@ -200,6 +200,22 @@
ZQAAAABJRU5ErkJggg==
</value>
</data>
+ <data name="btnEditarAnalisis.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJLSURBVDhPY/j//z8jPrxZRkZ6nZzc/M3y8pV7dHTE0dUy
+ EDJghZPTxGnc3D8XCgt/Xycru/+Enp4ish68Bvy42OF54eT2/9sbm//PlJH5O5OP7/8KcfHXm2Rlw2GG
+ 4DTg34Vmxa8nCw6/3u37/8nZ7r/nNm75v9DU9O90Hp7/iwUFSwka8PVE7uJ3e7z/v9io9v/JSq7/j3YH
+ /L19bc//tdl5O2dzc8PDAqsLfpwu8363N/j3q63G/5+tV/z7eI3o35ebdf4/WKf299Lt25Z4w+DLqVzD
+ Dwejrr/YYvD31XbLv8/WSvx/vc38//N1il+frxXIJRgLHw/FrX211ez/6532f19sMfz7aos+0ABLoAGS
+ W5+s4xXGY8Aq5q/HkzNfb7P4/3K71d93e3z+g7zwdrcH0PlaT79sF5HEFuXwMPh3baHwh1Mde1/tcv7/
+ 4UDM3zc7Hf+/3xvw/802i+8vt6hjOB0jFv7dm6P+4fKci++vrvj74Vz7/3cHIv6+3+v3//VWo4n/jllw
+ 4kpwCBc8Xmb+9fbS+x9urf3/8f6Ov5/vrvj/7lDU8y/bjbA6HcMF1ia6nolhrh8vHl3w/+vzQ6+/vTk/
+ /d/3W8qEkjrcBXJycsHCwiJ/3Vysl394tM/9//8zrIQ0g+QZZs6cybp06VLVmpqayrq6ut6FCxfGLlq0
+ KHnZsmW5QFy8ZMmS4sWLF+cC6WSgeCJQbTCQdgXpAekFGwBUoA4U8F2xYkU0SDFQQSGQrgVhoIFgDDSg
+ EEiDDIoF0v5ArAnSCwAohrR0D+dgxAAAAABJRU5ErkJggg==
+</value>
+ </data>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAAAAAAAEAIAD9kQAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAEAAAABAAgGAAAAXHKoZgAAIABJ
@@ -2,9 +2,6 @@
Imports System.IO
Imports MySql.Data.MySqlClient
Public Class frmOperacionesAnalisis
-
-
-
Dim iposicFilaActual As Integer = 0
Dim oDataAdapter As MySqlDataAdapter
Dim oDataSet As DataSet
@@ -101,26 +98,34 @@ Public Class frmOperacionesAnalisis
oConexion.Close()
lblMensajeAnalisis.ForeColor = System.Drawing.Color.Green
lblMensajeAnalisis.Text = "Mensaje: Los datos se han guardado exitosamente."
+
Catch ex As MySqlException
lblMensajeAnalisis.ForeColor = System.Drawing.Color.Red
- lblMensajeAnalisis.Text = "ERROR:: " & ex.Message & " " & ex.Number & " " & ex.GetType.ToString
+ lblMensajeAnalisis.Text = "ERROR: " & ex.Message & " " & ex.Number & " " & ex.GetType.ToString
Catch ex As DataException
lblMensajeAnalisis.ForeColor = System.Drawing.Color.Red
lblMensajeAnalisis.Text = "ERROR: " & ex.Message & " " & ex.GetType.ToString
+ Catch ex As Exception
+ lblMensajeAnalisis.ForeColor = System.Drawing.Color.Red
+ lblMensajeAnalisis.Text = "ERROR: " & ex.Message & " " & ex.GetType.ToString
End Try
+
+ 'Recarga los datos
+ Dim dbConsulta = "SELECT * FROM tblanalisis"
+ Dim nombreTabla = "tblanalisis"
+ 'EStablecer la posicion del registro a mostrar en la tabla
+ Me.iposicFilaActual = 0
+ txtClaveAnalisis.ReadOnly = True
+ txtNombreAnalisis.ReadOnly = True
btnInicio.Enabled = True
btnHaciaAtras.Enabled = True
btnHaciaAdelante.Enabled = True
btnFin.Enabled = True
btnInsAnalisis.Enabled = True
- btnGuardaAnalisis.Enabled = True
+ btnGuardaAnalisis.Enabled = False
btnUpdAnalisis.Enabled = True
btnDelAnalisis.Enabled = True
- 'Recarga los datos
- Dim dbConsulta = "SELECT * FROM tblanalisis"
- Dim nombreTabla = "tblanalisis"
- 'EStablecer la posicion del registro a mostrar en la tabla
- Me.iposicFilaActual = 0
+ btnBuscaAnalisis.Enabled = True
'Cargar columnas del registro en controles del formulario
llenaDataSet(dbConsulta, nombreTabla)
Me.cargarDatosAnalisis()
@@ -139,6 +144,7 @@ Public Class frmOperacionesAnalisis
btnGuardaAnalisis.Enabled = True
btnUpdAnalisis.Enabled = False
btnDelAnalisis.Enabled = False
+ btnBuscaAnalisis.Enabled = False
End Sub
@@ -159,6 +165,7 @@ Public Class frmOperacionesAnalisis
oConexion.Close()
lblMensajeAnalisis.ForeColor = System.Drawing.Color.Green
lblMensajeAnalisis.Text = "Mensaje: Los datos del análisis se han eliminado exitosamente."
+
Catch ex As MySqlException
lblMensajeAnalisis.ForeColor = System.Drawing.Color.Red
lblMensajeAnalisis.Text = "ERROR:: " & ex.Message & " " & ex.Number & " " & ex.GetType.ToString
@@ -171,7 +178,7 @@ Public Class frmOperacionesAnalisis
btnHaciaAdelante.Enabled = True
btnFin.Enabled = True
btnInsAnalisis.Enabled = True
- btnGuardaAnalisis.Enabled = True
+ btnGuardaAnalisis.Enabled = False
btnUpdAnalisis.Enabled = True
btnDelAnalisis.Enabled = True
'EStablecer la posicion del registro a mostrar en la tabla
@@ -183,10 +190,123 @@ Public Class frmOperacionesAnalisis
Me.cargarDatosAnalisis()
End Sub
+ Private Sub btnUpdAnalisis_Click(sender As System.Object, e As System.EventArgs) Handles btnUpdAnalisis.Click
+ Dim resultado As Integer
+ Try
+ txtNombreAnalisis.ReadOnly = False
+ txtClaveAnalisis.ReadOnly = True
+ btnInicio.Enabled = False
+ btnHaciaAtras.Enabled = False
+ btnHaciaAdelante.Enabled = False
+ btnFin.Enabled = False
+ btnInsAnalisis.Enabled = False
+ btnGuardaAnalisis.Enabled = True
+ btnUpdAnalisis.Enabled = False
+ btnDelAnalisis.Enabled = False
+ btnBuscaAnalisis.Enabled = False
+ Dim oConexion As MySqlConnection
+ Dim aConsulta As String = ""
+ Dim oComando As New MySqlCommand
+ oConexion = New MySqlConnection
+ oConexion.ConnectionString = "server=localhost;User Id=bvtselisa;password=password;Persist Security Info=True;database=bvtselisa"
+ aConsulta = "UPDATE tblanalisis SET nombreAnalisis='" & txtNombreAnalisis.Text & "'" & " WHERE idAnalisis='" & txtClaveAnalisis.Text & "'" & ";"
+ oComando.Connection = oConexion
+ oComando.CommandText = aConsulta
+ oConexion.Open()
+ resultado = oComando.ExecuteNonQuery()
+ oConexion.Close()
+ lblMensajeAnalisis.ForeColor = System.Drawing.Color.Green
+ lblMensajeAnalisis.Text = "Mensaje: El nombre del análisis se ha actualizado exitosamente."
+ btnInicio.Enabled = True
+ btnHaciaAtras.Enabled = True
+ btnHaciaAdelante.Enabled = True
+ btnFin.Enabled = True
+ btnInsAnalisis.Enabled = True
+ btnGuardaAnalisis.Enabled = True
+ btnUpdAnalisis.Enabled = True
+ btnDelAnalisis.Enabled = True
+ btnBuscaAnalisis.Enabled = True
+ Catch ex As MySqlException
+ lblMensajeAnalisis.ForeColor = System.Drawing.Color.Red
+ lblMensajeAnalisis.Text = "ERROR: " & ex.Message & " " & ex.Number & " " & ex.GetType.ToString
+ Catch ex As DataException
+ lblMensajeAnalisis.ForeColor = System.Drawing.Color.Red
+ lblMensajeAnalisis.Text = "ERROR: " & ex.Message & " " & ex.GetType.ToString
+ Catch ex As Exception
+ lblMensajeAnalisis.ForeColor = System.Drawing.Color.Red
+ lblMensajeAnalisis.Text = "ERROR: " & ex.Message & " " & ex.GetType.ToString
+ End Try
+ End Sub
+
+ Private Sub btnBuscaAnalisis_Click(sender As System.Object, e As System.EventArgs) Handles btnBuscaAnalisis.Click
+ txtClaveAnalisis.ReadOnly = False
+ Try
+ Dim oConexion As MySqlConnection
+ Dim aConsulta As String = ""
+ Dim oComando As New MySqlCommand
+ Dim oDataReader As MySqlDataReader
+ oConexion = New MySqlConnection
+ oConexion.ConnectionString = "server=localhost;User Id=bvtselisa;password=password;Persist Security Info=True;database=bvtselisa"
+ aConsulta = "SELECT * FROM tblanalisis WHERE idAnalisis='" & txtClaveAnalisis.Text & "'" & ";"
+ oComando.Connection = oConexion
+ oComando.CommandText = aConsulta
+ If txtClaveAnalisis.Text = "" Then
+ txtNombreAnalisis.Text = ""
+ lblMensajeAnalisis.ForeColor = System.Drawing.Color.Red
+ lblMensajeAnalisis.Text = "Mensaje:Escriba un valor en la clave del análisis."
+ Else
+ oConexion.Open()
+ oDataReader = oComando.ExecuteReader()
+ If oDataReader.HasRows Then
+ While oDataReader.Read()
+ txtClaveAnalisis.Text = oDataReader("idAnalisis")
+ txtNombreAnalisis.Text = oDataReader("NombreAnalisis")
+ End While
+ oDataReader.Close()
+ lblMensajeAnalisis.Text = ""
+ Else
+ lblMensajeAnalisis.ForeColor = System.Drawing.Color.Red
+ lblMensajeAnalisis.Text = "Mensaje: No existe un análisis con la clave indicada."
+ End If
+ oConexion.Close()
+ txtClaveAnalisis.Focus()
+ 'Verifica que no sea vacia la consulta
+ End If
+ Catch ex As MySqlException
+ lblMensajeAnalisis.ForeColor = System.Drawing.Color.Red
+ lblMensajeAnalisis.Text = "ERROR: " & ex.Message & " " & ex.Number & " " & ex.GetType.ToString
+ Catch ex As DataException
+ lblMensajeAnalisis.ForeColor = System.Drawing.Color.Red
+ lblMensajeAnalisis.Text = "ERROR: " & ex.Message & " " & ex.GetType.ToString
+ Catch ex As Exception
+ lblMensajeAnalisis.ForeColor = System.Drawing.Color.Red
+ lblMensajeAnalisis.Text = "ERROR: " & ex.Message & " " & ex.GetType.ToString
+ End Try
+ End Sub
+
+ Private Sub txtClaveAnalisis_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtClaveAnalisis.TextChanged
+ txtNombreAnalisis.Text = ""
+ End Sub
+
+ Private Sub btnEditarAnalisis_Click(sender As System.Object, e As System.EventArgs) Handles btnEditarAnalisis.Click
+ 'Deshabilitar todos los botones excepto editar y UpdateAnalisis
+ btnInicio.Enabled = False
+ btnHaciaAtras.Enabled = False
+ btnHaciaAdelante.Enabled = False
+ btnFin.Enabled = False
+ btnInsAnalisis.Enabled = False
+ btnGuardaAnalisis.Enabled = False
+ btnUpdAnalisis.Enabled = True
+ btnDelAnalisis.Enabled = False
+ btnBuscaAnalisis.Enabled = False
+ 'Permito la escritura sobre los campos
+ txtNombreAnalisis.ReadOnly = False
+ txtClaveAnalisis.ReadOnly = True
+ End Sub
+
Private Sub btnCancelarAnalisis_Click(sender As System.Object, e As System.EventArgs) Handles btnCancelarAnalisis.Click
Me.Close()
End Sub
-
End Class
Binary file not shown.
Binary file not shown.

0 comments on commit 8a95345

Please sign in to comment.