用vs2005打开源程序,运行时所用用到msgbox地方都显示如下错误信息:
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. 
  但同样的程序我通过iis配置后,直接运行站点(http://leo/xx)就没有这个错误。这个问题应该怎么解决??

解决方案 »

  1.   

    web上用,not msgbox
    <script>
    alert("ok")
    </script>
      

  2.   

    不好意思,应该是用vs2005打开运行没问题,而用ie直接运行站点出现上述错误信息。楼上的,我的程序是asp.net(vb).例如在test.aspx.vb中有如下代码:
    Private Sub AskAndToSave()
        If MsgBox("内容被修改!是否要保存?", MsgBoxStyle.YesNo, gstNSS) = vbYes Then
           StoreTextToResultset()
        Else
           DataSaved = False
        End If
    End Sub
    我觉得这样写应该没有问题啊,况且用vs2005代开源程序运行也没问题啊。急等回复?
      

  3.   

    MsgBox这个只能用在WIN FORM吧.WEB里面只能用
    <script>
    alert("ok")
    </script>
    这种模式
      

  4.   

    好像在ASP.NET中没有MESSAGEBOX方法,这个方法好像只有在WINF中有吧
      

  5.   

    弹出一个对话框属于客户端的东西,服务器端的代码是无法生成的,只有用客户端的脚本javascript来实现。用alert或者msgbox
      

  6.   

    MsgBox是在服务器端弹出窗口,改用客户端脚本