Foros del Web » Programación para mayores de 30 ;) » .NET »

Error con msgbox, porfa ayuda!

Estas en el tema de Error con msgbox, porfa ayuda! en el foro de .NET en Foros del Web. saludos, Este es mi codigo: Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_eliminar.Click If MsgBox("¿Está seguro de eliminar al usuario " ...
  #1 (permalink)  
Antiguo 12/01/2007, 08:28
 
Fecha de Ingreso: enero-2007
Mensajes: 80
Antigüedad: 17 años, 4 meses
Puntos: 0
Error con msgbox, porfa ayuda!

saludos,

Este es mi codigo:

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_eliminar.Click
If MsgBox("¿Está seguro de eliminar al usuario " & Me.txt_nombre.Text & "?", MsgBoxStyle.YesNo, "Administrador") = MsgBoxResult.Yes Then
Try
cn.ConnectionString = var_cn
If cn.State = ConnectionState.Open Then
cn.Close()
End If
cn.Open()
With cmd
.Connection = cn
.CommandType = CommandType.Text
.CommandText = "DELETE FROM USUARIO WHERE (usuario_usuario='" & Me.txt_usuario.Text & "');"
.ExecuteNonQuery()
limpiar_controles()
End With
cn.Close()
Me.Response.Redirect("Default2.aspx")
Catch ex As Exception
Me.Label1.Text = "error" + ex.Message
End Try
Else
Me.Response.Redirect("Default2.aspx")
End If
End Sub

ya esta mi sitio levantado a traves del FTP, cuando doy clic en el boton eliminar se tiene que presentar un mensaje en un msgbox prguntando si estoy segura de eliminar dicho registro; pero en vez de eso se presenta este error:

Server Error in '/pc' Application.
--------------------------------------------------------------------------------

Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.]
System.Windows.Forms.MessageBox.ShowCore(IWin32Win dow owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, Boolean showHelp) +1801538
System.Windows.Forms.MessageBox.Show(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options) +26
Microsoft.VisualBasic.Interaction.MsgBox(Object Prompt, MsgBoxStyle Buttons, Object Title) +544
_administracion_mantenimiento_usuarios_default4.Bu tton1_Click(Object sender, EventArgs e) +83
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210

muchas gracias a quien pueda ayudarme, y tal vez corregirme el codigo que les muestro ahi!
  #2 (permalink)  
Antiguo 12/01/2007, 09:10
Avatar de erick_arcini  
Fecha de Ingreso: julio-2005
Ubicación: Jaltenco / DF
Mensajes: 1.723
Antigüedad: 18 años, 9 meses
Puntos: 50
Re: Error con msgbox, porfa ayuda!

no puedes usar el msgbox en una aplicacion web, en este caso tendrias que utilizar javascript para establecer la caja de dialogo
__________________
Mejoremos nuestro país, ayudemos al planeta... próximamente.
  #3 (permalink)  
Antiguo 12/01/2007, 14:18
 
Fecha de Ingreso: enero-2007
Mensajes: 80
Antigüedad: 17 años, 4 meses
Puntos: 0
Re: Error con msgbox, porfa ayuda!

gracias, pero me podrias ayudar con eso de verdad te lo agradeceria mucho a cualquiera queme pueda dar una
  #4 (permalink)  
Antiguo 12/01/2007, 14:58
Avatar de erick_arcini  
Fecha de Ingreso: julio-2005
Ubicación: Jaltenco / DF
Mensajes: 1.723
Antigüedad: 18 años, 9 meses
Puntos: 50
Re: Error con msgbox, porfa ayuda!

revisa este articulo, es muy bueno:
__________________
Mejoremos nuestro país, ayudemos al planeta... próximamente.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:30.