|
Mostrar Mensajes
|
Páginas: 1 2 3 [4] 5 6 7
|
31
|
Programación / .NET (C#, VB.NET, ASP) / Re: Problema con aplicaccion en vb.net
|
en: 22 Junio 2010, 19:50 pm
|
jajaja no amigo, se envio de casualidad, el codigo de capturar es este: Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hSrcDC As Integer, ByVal xSrc As Integer, ByVal ySrc As Integer, ByVal dwRop As Integer) As Integer Public Enum TernaryRasterOperations 'API BitBlt SRCCOPY = &HCC0020 SRCPAINT = &HEE0086 SRCAND = &H8800C6 SRCINVERT = &H660046 SRCERASE = &H440328 NOTSRCCOPY = &H330008 NOTSRCERASE = &H1100A6 MERGECOPY = &HC000CA MERGEPAINT = &HBB0226 PATCOPY = &HF00021 PATPAINT = &HFB0A09 PATINVERT = &H5A0049 DSTINVERT = &H550009 BLACKNESS = &H42 WHITENESS = &HFF0062 End Enum Private Sub Capturar(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCapturar.Click Dim srcGraphics As Graphics = WebBrowser1.CreateGraphics Try Dim destGraphics As Graphics = PictureBox1.CreateGraphics Try Dim hdcDest As IntPtr = destGraphics.GetHdc Dim hdcSrc As IntPtr = srcGraphics.GetHdc BitBlt(hdcDest, 0, 0, WebBrowser1.ClientRectangle.Width, WebBrowser1.ClientRectangle.Height, hdcSrc, 0, 0, CType(TernaryRasterOperations.SRCCOPY, Integer)) srcGraphics.ReleaseHdc(hdcSrc) destGraphics.ReleaseHdc(hdcDest) lblCaptura.Visible = True Finally CType(destGraphics, IDisposable).Dispose() End Try Finally CType(srcGraphics, IDisposable).Dispose() End Try End Sub
Mi aplicacion: El codigo posible a la solucion en el boton capturar pero que no me funciona: Private Sub Capturar(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCapturar.Click Dim srcGraphics As Graphics = WebBrowser1.CreateGraphics Try Dim destGraphics As Graphics = PictureBox1.CreateGraphics Dim bmpSource As New Bitmap(PictureBox1.Width, PictureBox1.Height, destGraphics) bmpSource.Save("Image.jpg", System.Drawing.Imaging.ImageFormat.Jpeg) Try Dim hdcDest As IntPtr = destGraphics.GetHdc Dim hdcSrc As IntPtr = srcGraphics.GetHdc BitBlt(hdcDest, 0, 0, WebBrowser1.ClientRectangle.Width, WebBrowser1.ClientRectangle.Height, hdcSrc, 0, 0, CType(TernaryRasterOperations.SRCCOPY, Integer)) srcGraphics.ReleaseHdc(hdcSrc) destGraphics.ReleaseHdc(hdcDest) lblCaptura.Visible = True PictureBox1.Image = bmpSource.Clone() Finally CType(destGraphics, IDisposable).Dispose() End Try Finally CType(srcGraphics, IDisposable).Dispose() End Try End Sub
|
|
|
32
|
Programación / .NET (C#, VB.NET, ASP) / Problema con aplicaccion en vb.net
|
en: 22 Junio 2010, 19:30 pm
|
Hola a todos , estaba haciendo una aplicacion en donde capturo la pantalla de lo que se muestra en un webbrowser despues de hacer un resize, el problema es el siguiente: Al momento de hacer la captura de pantalla, la nueva imagen se almacena en memoria y al hacer click en el boton "Vista Previa" la aplicacion se cae ya que aparece un mensaje diciendo que la propiedad "PictureBox1.Image es null". (Lo cual me dice que la imagen capturada no se almacena en la propiedad Image del PictureBox).
Estaba intentando implementar eso y me dijeron que debia hacer previamente un "Save" en el Image del pictureBox para que la aplicacion no se caiga.Mi aplicacion es la siguiente: El Codigo del boton "Capturar" es este: El Codigo posible y que nose bien como implementarlo (ya que no funciona) para guardar la imagen en la propiedad Image, es este: Espero me puedan ayudar, gracias!
|
|
|
34
|
Programación / .NET (C#, VB.NET, ASP) / Problema con base de datos y VB.net
|
en: 21 Junio 2010, 01:52 am
|
Hola a todos, soy nuevo en VB.Net y estoy haciendo una aplicacion que me permite ver la informacion obtenida mediante un formulario en PHP. Todo esto utilizando el Driver ODBC. Hasta ahi todo bien El formulario es el siguiente: El Tabla SQL es la siguiente: (utilizo todo VARCHAR ya que en la aplicacion solo muestro datos, no efectuo operaciones con los valores, por lo tanto no es necesario reconocer un valor INT ) Y mi aplicacion, la siguiente: Ahora, mis problemas son los siguientes: 1) Quiero hacer que el comboBox con los ID's carguen en la posicion 1 o sea que la posicion 0 sea "Seleccione".. ejemplo: cboID.Items.Add("Seleccione") -> Posicion cero cboID.Items.Add("ID01") -> Posicion uno Y Asi todos los ID's de la DB, es eso posible? 2) Tengo un problema al actualizar los datos. Al dar click en "Editar" y luego "Grabar" y ejecutar la consulta UPDATE en la DB. SIEMPRE, asi el textbox este vacio o lleno, SIEMPRE me agrega un NULL a la base de datos y nose como arreglar eso. Luego, cuando intento ver los valores modificados, el programa se cae ya que dice que un tipo DBNull no puede ser convertido a tipo String (Este problema tampoco lo se controlar) Espero me puedan ayudar a controlar los NULL's A ver porque siempre se envian los datos como NULL y a poder arreglar el comboBox como deseo Aqui les paso el codigo del Boton Grabar: Private Sub Grabar(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGrabar.Click Dim obj As New frmLogin() If operacion = TipoOperacion.Ninguna Then MessageBox.Show("No hay nada que 'Grabar'.", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Else If txtNombres.Text.Trim.Length > 0 Then If txtApellidos.Text.Trim.Length > 0 Then If txtDNICarneExtranjeria.Text.Trim.Length > 0 Then If txtTelefonoFijo.Text.Trim.Length > 0 Or txtCelular.Text.Trim.Length > 0 Then obj.con.Open() Dim cmd As New OdbcCommand("", obj.con) Dim mensaje As String = "" If MessageBox.Show("Seguro de Guardar la Inscripción?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then If operacion = TipoOperacion.Actualizar Then cmd.CommandText = "UPDATE inscripciones SET Nombres=@Nombres,Apellidos=@Apellidos,DNI_CarneExtranjeria=@DNI_CarneExtranjeria,Tipo_Persona=@Tìpo_Persona,Empresa=@Empresa,Cargo=@Cargo,Direccion=@Direccion,Telefono_Fijo=@Telefono_Fijo,Telefono_Celular=@Telefono_Celular,Tipo_Comprobante=@Tipo_Comprobante,Razon_Social=@Razon_Social,RUC=@RUC,Nombre_Voucher=@Nombre_Voucher WHERE ID=" & cboID.SelectedValue mensaje = "Inscripción Actualizada." End If cmd.Parameters.Add("@Nombres", OdbcType.VarChar, 50).Value = txtNombres.Text cmd.Parameters.Add("@Apellidos", OdbcType.VarChar, 50).Value = txtApellidos.Text cmd.Parameters.Add("@DNI_CarneExtranjeria", OdbcType.VarChar, 15).Value = txtDNICarneExtranjeria.Text cmd.Parameters.Add("@Tipo_Persona", OdbcType.VarChar, 13).Value = txtTipoPersona.Text cmd.Parameters.Add("@Empresa", OdbcType.VarChar, 60).Value = txtEmpresa.Text cmd.Parameters.Add("@Cargo", OdbcType.VarChar, 30).Value = txtCargo.Text cmd.Parameters.Add("@Direccion", OdbcType.VarChar, 100).Value = txtDireccion.Text cmd.Parameters.Add("@Telefono_Fijo", OdbcType.VarChar, 25).Value = txtTelefonoFijo.Text cmd.Parameters.Add("@Telefono_Celular", OdbcType.VarChar, 25).Value = txtCelular.Text cmd.Parameters.Add("@Tipo_Comprobante", OdbcType.VarChar, 7).Value = txtTipoComprobante.Text cmd.Parameters.Add("@Razon_Social", OdbcType.VarChar, 60).Value = txtRazonSocial.Text cmd.Parameters.Add("@RUC", OdbcType.VarChar, 11).Value = txtRUC.Text cmd.Parameters.Add("@Nombre_Voucher", OdbcType.VarChar, 50).Value = txtNombreVoucher.Text Dim N As Integer = cmd.ExecuteNonQuery If N > 0 Then MessageBox.Show(mensaje, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information) btnEliminar.Enabled = True btnGrabar.Enabled = False ConsultarInscrito() cboID.Focus() Else MessageBox.Show("No se pudo Realizar la Operación.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) btnEliminar.Enabled = True btnGrabar.Enabled = False cboID.Focus() End If obj.con.Close() operacion = TipoOperacion.Ninguna HabilitarControles(False) cboID.Enabled = True btnCancelar.Enabled = False cboID.Focus() Else txtNombres.Focus() End If Else MessageBox.Show("Ingrese al menos un 'Teléfono'.", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) txtTelefonoFijo.Focus() End If 'Telefonos Else MessageBox.Show("Ingrese el 'DNI o Carne de Extranjería'.", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) txtDNICarneExtranjeria.Focus() End If 'DNI o Carne Extranjeria Else MessageBox.Show("Ingrese los 'Apellidos'.", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) txtApellidos.Focus() End If 'Apellidos Else MessageBox.Show("Ingrese los 'Nombres'.", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) txtNombres.Focus() End If 'Nombres End If End Sub
Y el codigo del metodo Consultar Inscrito que se usa el boton Grabar para hacer una especie de "Refresh" cuando los datos se grabaron: Private Sub ConsultarInscrito() Dim obj As New frmLogin() obj.con.Open() Dim cmd As New OdbcCommand("SELECT Nombres,Apellidos,DNI_CarneExtranjeria,Tipo_Persona,Empresa,Cargo,Direccion,Telefono_Fijo,Telefono_Celular,Tipo_Comprobante,Razon_Social,RUC,Nombre_Voucher FROM inscripciones WHERE ID=" & cboID.SelectedValue, obj.con) Dim drd As OdbcDataReader = cmd.ExecuteReader(CommandBehavior.SingleRow) If drd.HasRows = False Then MessageBox.Show("No hay 'Datos' por mostrar'.", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) End If If drd IsNot Nothing Then If drd.HasRows Then drd.Read() txtNombres.Text = drd.GetString(0) txtApellidos.Text = drd.GetString(1) txtDNICarneExtranjeria.Text = drd.GetString(2) txtTipoPersona.Text = drd.GetString(3) txtEmpresa.Text = drd.GetString(4) txtCargo.Text = drd.GetString(5) txtDireccion.Text = drd.GetString(6) txtTelefonoFijo.Text = drd.GetString(7) txtCelular.Text = drd.GetString(8) txtTipoComprobante.Text = drd.GetString(9) txtRazonSocial.Text = drd.GetString(10) txtRUC.Text = drd.GetString(11) txtNombreVoucher.Text = drd.GetString(12) wbVoucher.Navigate("http://www.dominio.com/inscripciones/vouchers/" + txtNombreVoucher.Text) cboID.Focus() btnEditar.Enabled = True btnEliminar.Enabled = True drd.Close() End If End If obj.con.Close() cboID.Enabled = True btnEliminar.Enabled = True End Sub
GRACIAS y en verdad espero su ayuda
|
|
|
36
|
Programación / PHP / Error de sintaxis en PHP :S
|
en: 17 Junio 2010, 01:06 am
|
Hola, me aparecio este error en la linea 70 "unexpected T_ECHO" y no logro ubicarlo. Soy nuevo en PHP, espero su ayuda... muchas gracias <?php if (isset($_POST['enviar'])){ $sql = "SELECT MAX(ID) FROM inscripciones"; $max_id = $row[0]+1; $nombres = trim($_POST['nombres']); $apellidos = trim($_POST['apellidos']); $DNI_CarneExtranjeria = trim($_POST['DNI_CarneExtranjeria']); $tipo_persona = trim($_POST['tipo_persona']); $empresa = trim($_POST['empresa']); $cargo = trim($_POST['cargo']); $direccion = trim($_POST['direccion']); $telefono_fijo = trim($_POST['telefono_fijo']); $telefono_celular = trim($_POST['telefono_celular']); $tipo_combrobante = trim($_POST['tipo_comprobante']); $razon_social = trim($_POST['razon_social']); $RUC=trim($_POST['RUC']); $_FILES['voucher']['name'] = $max_id."_".$_FILES['voucher']['name']; $upload_dir = '/home/name/public_html/inscripciones/vouchers/'; $extension = $_FILES['voucher']['type']; $mimetypes = array("image/jpeg", "image/gif", "image/png"); $size = $_FILES['voucher']['size']; $upload_file = $upload_dir.($_FILES['voucher']['name']); $voucher_nombre_db = $_FILES['voucher']['name']; echo '<html> <head> <title>Titulo Web</title> <META http-equiv="refresh" content="1; url=http://www.dominio.com/inscripciones/inscripcion.php"> </head> <body> <p>ERROR: Debe ingresar sus nombres.</p> </body> </html>'; elseif(isset($_POST['apellidos']) && strlen(trim($_POST['apellidos']))== 0) echo '<html> <head> <title>Titulo Web</title> <META http-equiv="refresh" content="1; url=http://www.dominio.com/inscripciones/inscripcion.php"> </head> <body> <p>ERROR: Debe ingresar sus apellidos.</p> </body> </html>'; elseif(isset($_POST['DNI_CarneExtranjeria']) && strlen(trim($_POST['DNI_CarneExtranjeria']))== 0) echo '<html> <head> <title>Titulo Web</title> <META http-equiv="refresh" content="1; url=http://www.dominio.com/inscripciones/inscripcion.php"> </head> <body> <p>ERROR: Debe ingresar su DNI o Carne de Extranjeria.</p> </body> </html>'; elseif((isset($_POST['tipo_persona'])== "Dependiente") && ((isset($_POST['empresa']) && strlen(trim($_POST['empresa']))== 0) || (isset($_POST['cargo']) && strlen(trim($_POST['cargo']))== 0) || (isset($_POST['direccion']) && strlen(trim($_POST['direccion']))== 0))) echo '<html> <head> <title>Titulo Web</title> <META http-equiv="refresh" content="1; url=http://www.dominio.com/inscripciones/inscripcion.php"> </head> <body> <p>ERROR: Debe completar los datos de persona dependiente.</p> </body> </html>'; elseif((isset($_POST['tipo_telefono'])== "Ambos" && ((isset($_POST['telefono_fijo']) && strlen(trim($_POST['telefono_fijo']))== 0) || (isset($_POST['telefono_celular']) && strlen(trim($_POST['telefono_celular']))== 0))) echo '<html> <head> <title>Titulo Web</title> <META http-equiv="refresh" content="1; url=http://www.dominio.com/inscripciones/inscripcion.php"> </head> <body> <p>ERROR: Debe ingresar sus numeros telefonicos.</p> </body> </html>'; elseif((isset($_POST['tipo_telefono'])== "Telf. Fijo" && (isset($_POST['telefono_fijo']) && strlen(trim($_POST['telefono_fijo']))== 0))) echo '<html> <head> <title>Titulo Web</title> <META http-equiv="refresh" content="1; url=http://www.dominio.com/inscripciones/inscripcion.php"> </head> <body> <p>ERROR: Debe ingresar el numero de telefono fijo.</p> </body> </html>'; elseif((isset($_POST['tipo_telefono'])== "Celular" && (isset($_POST['telefono_celular']) && strlen(trim($_POST['telefono_celular']))== 0))) echo '<html> <head> <title>Titulo Web</title> <META http-equiv="refresh" content="1; url=http://www.dominio.com/inscripciones/inscripcion.php"> </head> <body> <p>ERROR: Debe ingresar el numero de telefono celular.</p> </body> </html>'; elseif((isset($_POST['tipo_comprobante'])== "Factura") && ((isset($_POST['razon_social']) && strlen(trim($_POST['razon_social']))== 0) || (isset($_POST['RUC'])&& strlen(trim($_POST['RUC']))== 0))) echo '<html> <head> <title>Titulo Web</title> <META http-equiv="refresh" content="1; url=http://www.dominio.com/inscripciones/inscripcion.php"> </head> <body> <p>ERROR: Debe completar los datos del comprobante factura.</p> </body> </html>'; elseif((isset($_FILES['voucher']['name']) && strlen(trim($_POST['voucher']['name']))== 0) || (isset($_FILES['voucher']['type']) != ($mimetypes[0] || $mimetypes[1] || $mimetypes[2])) || (isset($_FILES['voucher']['size']) > 0 && isset($_FILES['voucher']['size']) <= 204800)) echo '<html> <head> <title>Titulo Web</title> <META http-equiv="refresh" content="1; url=http://www.dominio.com/inscripciones/inscripcion.php"> </head> <body> <p>ERROR: Debe adjuntar la imagen del voucher (Formatos permitidos: JPG, PNG, GIF / Tamaño Maximo: 200 KB).</p> </body> </html>'; else{ mysql_query("INSERT INTO inscripciones(Nombres,Apellidos,DNI_CarneExtranjeria,Tipo_Persona,Empresa,Cargo,Direccion,Telefono_Fijo,Telefono_Celular,Tipo_Comprobante,Razon_Social,RUC,Nombre_Voucher) VALUES('$nombres','$apellidos','$DNI_CarneExtranjeria','$tipo_persona','$empresa','$cargo','$direccion','$telefono_fijo','$telefono_celular','$tipo_comprobante','$razon_social','$RUC','$voucher_nombre_db')",$link); echo '<html> <head> <title>Titulo Web</title> <META http-equiv="refresh" content="2; url=http://www.dominio.com/inscripciones/inscripcion.php"> </head> <body> <p>Registro exitoso.</p> </body> </html>'; } } ?>
|
|
|
39
|
Programación / PHP / Problema con validaciones de formulario en PHP
|
en: 9 Junio 2010, 16:29 pm
|
El formulario consiste en almacenar los datos en la DB. El problema es que las validaciones de PHP no funcionan y nose porque. El formulario es como esta imagen: TODOS LOS CAMPOS SON REQUERIDOS: http://img405.imageshack.us/i/form01d.jpgPERO, SI EL USUARIO SELECCIONA EN INDEPENDIENTE, EN BOLETA Y UN TIPO DE TELF. LOS DATOS DEBEN SER REQUERIDOS. http://img405.imageshack.us/i/form02.jpgintente validarlo en php pero no me resulta (como lo dije en un post anterior), sin embargo en javascript ya esta hecho pero como se sabe, el usuario puede deshabilitar el javascript y es por eso que la validacion php se require. <?php if (isset($_POST['enviar'])){ $sql = "SELECT MAX(ID) FROM inscripciones"; $max_id = $row[0]+1; $nombres=trim($_POST['nombres']); $apellidos=trim($_POST['apellidos']); $DNI_CarneExtranjeria=trim($_POST['DNI_CarneExtranjeria']); $tipo_persona=trim($_POST['tipo_persona']); $empresa=trim($_POST['empresa']); $cargo=trim($_POST['cargo']); $direccion=trim($_POST['direccion']); $telefono_fijo=trim($_POST['telefono_fijo']); $telefono_celular=trim($_POST['telefono_celular']); $tipo_combrobante=trim($_POST['tipo_comprobante']); $razon_social=trim($_POST['razon_social']); $RUC=trim($_POST['RUC']); $_FILES['voucher']['name'] = $max_id."_".$_FILES['voucher']['name']; $upload_dir = '/home/netline/public_html/inscripciones/vouchers/'; $extension = $_FILES['voucher']['type']; $size = $_FILES['voucher']['size']; $upload_file = $upload_dir.($_FILES['voucher']['name']); $voucher_nombre_db = $_FILES['voucher']['name']; if(empty($nombres) && empty($apellidos) && empty($DNI_CarneExtranjeria) && ($tipo_persona == 'Dependiente' && (empty($empresa) || empty($cargo) || empty($direccion))) &&(empty($telefono_fijo) || empty($telefono_celular)) && ($tipo_comprobante == 'Factura' && (empty($razon_social) || empty($RUC))) && empty($voucher_nombre_db) && $extension != 'image/jpeg' && $size > 204801){ echo '<html> <head> <title>Titulo web</title> <META http-equiv="refresh" content="6; url=http://www.dominio.com/inscripciones/inscripcion.php"> </head> <body> <p>Debe completar todos los datos obligatorios y adjuntar una imagen con extension .JPG y de 200KB de tamaño maximo.</p> </body> </html>'; }else{ mysql_query("INSERT INTO inscripciones(Nombres,Apellidos,DNI_CarneExtranjeria,Tipo_Persona,Empresa,Cargo,Direccion,Telefono_Fijo,Telefono_Celular,Tipo_Comprobante,Razon_Social,RUC,Nombre_Voucher) VALUES('$nombres','$apellidos','$DNI_CarneExtranjeria','$tipo_persona','$empresa','$cargo','$direccion','$telefono_fijo','$telefono_celular','$tipo_comprobante','$razon_social','$RUC','$voucher_nombre_db')",$link); echo '<html> <head> <title>Titulo web</title> <META http-equiv="refresh" content="6; url=http://www.dominio.com/inscripciones/inscripcion.php"> </head> <body> <p>Registro exitoso.</p> </body> </html>'; } } ?>
el if de mi archivo php lo explicare de la siguiente forma: Si nombres esta vacio, apellidos esta vacio, tipo persona es dependiente (y empresa, cargo, direccion estan vacios) y (telefono fijo esta vacio o telefono celular esta vacio - ya que siempre debe haber un telf.) y tipo de comprobante igual a factura (y razon social y ruc estan vacios) y voucher esta vacio y es diferente a jpg y es mayor a 200kb ENTONCES se muestra mensaje de error. De lo contrario subir el archivo y los datos. Espero me puedan ayudar con la validacion, gracias
|
|
|
40
|
Programación / PHP / Re: Ayuda con validacion de formulario PHP
|
en: 9 Junio 2010, 15:40 pm
|
no era la intencion que pareciera que gritara pero en fin, los valores de las variables si me llegan a la base de datos, lo que no me funciona es la validacion y nose por que... asi desactive el javascript en el formulario, la validacion php no funciona
|
|
|
|
|
|
|