Dumb question about Message boxes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Coleen

    Dumb question about Message boxes

    I'm using MS .Net Version 7, using VB .Net working on a "simple" web page.
    All I want to do is display a messagebox. I tried using Messagebox.Show ,
    and get an error that Messagebox has not been declared. I tried using
    MsgBox (like we used in VB 6) but this throws application errors every time
    I run it I get the error "It is in valid to show a modal or form when the
    application is not running in UserInteractive mode. Specify the
    ServiceNotifica tion or DefaultDesktopO nly style to display a notice from a
    service application" I tried Response.Write, which just puts the message in
    the background of my web page, not popping up like a REAL MsgBox! Please
    help with this, this should be SIMPLE!!! TIA

    Coleen



  • Norman Yuan

    #2
    Re: Dumb question about Message boxes

    It seems that you are talking about Web app. Do you really want to show a
    MessageBox on the web server, while user sits in front of a web browser
    thousands kilometers away? How does the user know a MessageBox pops up on
    the web server? In Web app, if you want to nitify user something, you should
    have the web server send back a page to user, either in the same browser
    window or in a new browser window.

    By the way, MessageBox is in System.Windows. Forms namespace, which is not
    referenced in web app by default. That is why you get error "Not declared".


    "Coleen" <coleenholley@y ahoo.com> wrote in message
    news:OCUj0dduDH A.424@TK2MSFTNG P11.phx.gbl...[color=blue]
    > I'm using MS .Net Version 7, using VB .Net working on a "simple" web page.
    > All I want to do is display a messagebox. I tried using Messagebox.Show ,
    > and get an error that Messagebox has not been declared. I tried using
    > MsgBox (like we used in VB 6) but this throws application errors every[/color]
    time[color=blue]
    > I run it I get the error "It is in valid to show a modal or form when the
    > application is not running in UserInteractive mode. Specify the
    > ServiceNotifica tion or DefaultDesktopO nly style to display a notice from[/color]
    a[color=blue]
    > service application" I tried Response.Write, which just puts the message[/color]
    in[color=blue]
    > the background of my web page, not popping up like a REAL MsgBox! Please
    > help with this, this should be SIMPLE!!! TIA
    >
    > Coleen
    >
    >
    >[/color]


    Comment

    • Coleen

      #3
      Re: Dumb question about Message boxes

      What I am doing is writing validation for a Web form. If data is entered
      incorrectly, I want a messagebox to notify the user the data type is
      incorrect...I tried putting in the Name Space for System.Window, but that
      did not work either. Ugh! This used to be simple! thanks for any/all of
      your help.
      "Norman Yuan" <normanyuan@Rem oveThis.shaw.ca > wrote in message
      news:ccszb.5493 86$6C4.180063@p d7tw1no...[color=blue]
      > It seems that you are talking about Web app. Do you really want to show a
      > MessageBox on the web server, while user sits in front of a web browser
      > thousands kilometers away? How does the user know a MessageBox pops up on
      > the web server? In Web app, if you want to nitify user something, you[/color]
      should[color=blue]
      > have the web server send back a page to user, either in the same browser
      > window or in a new browser window.
      >
      > By the way, MessageBox is in System.Windows. Forms namespace, which is not
      > referenced in web app by default. That is why you get error "Not[/color]
      declared".[color=blue]
      >
      >
      > "Coleen" <coleenholley@y ahoo.com> wrote in message
      > news:OCUj0dduDH A.424@TK2MSFTNG P11.phx.gbl...[color=green]
      > > I'm using MS .Net Version 7, using VB .Net working on a "simple" web[/color][/color]
      page.[color=blue][color=green]
      > > All I want to do is display a messagebox. I tried using[/color][/color]
      Messagebox.Show ,[color=blue][color=green]
      > > and get an error that Messagebox has not been declared. I tried using
      > > MsgBox (like we used in VB 6) but this throws application errors every[/color]
      > time[color=green]
      > > I run it I get the error "It is in valid to show a modal or form when[/color][/color]
      the[color=blue][color=green]
      > > application is not running in UserInteractive mode. Specify the
      > > ServiceNotifica tion or DefaultDesktopO nly style to display a notice[/color][/color]
      from[color=blue]
      > a[color=green]
      > > service application" I tried Response.Write, which just puts the[/color][/color]
      message[color=blue]
      > in[color=green]
      > > the background of my web page, not popping up like a REAL MsgBox![/color][/color]
      Please[color=blue][color=green]
      > > help with this, this should be SIMPLE!!! TIA
      > >
      > > Coleen
      > >
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Coleen

        #4
        Re: Dumb question about Message boxes

        When I put System.Windows. Forms in the Namespace I get the blue squiggly
        line with the message "Namespace or type 'forms' for the Imports
        'System.Windows .forms' cannot be found. What's up with that? Usually, when
        you put in the Namespace, the choices pop-up after you type the . but in
        this case, Windows does not come up as one of the available choices under
        System! How can I put in a Namespace when it is not available or supported?

        "Norman Yuan" <normanyuan@Rem oveThis.shaw.ca > wrote in message
        news:ccszb.5493 86$6C4.180063@p d7tw1no...[color=blue]
        > It seems that you are talking about Web app. Do you really want to show a
        > MessageBox on the web server, while user sits in front of a web browser
        > thousands kilometers away? How does the user know a MessageBox pops up on
        > the web server? In Web app, if you want to nitify user something, you[/color]
        should[color=blue]
        > have the web server send back a page to user, either in the same browser
        > window or in a new browser window.
        >
        > By the way, MessageBox is in System.Windows. Forms namespace, which is not
        > referenced in web app by default. That is why you get error "Not[/color]
        declared".[color=blue]
        >
        >
        > "Coleen" <coleenholley@y ahoo.com> wrote in message
        > news:OCUj0dduDH A.424@TK2MSFTNG P11.phx.gbl...[color=green]
        > > I'm using MS .Net Version 7, using VB .Net working on a "simple" web[/color][/color]
        page.[color=blue][color=green]
        > > All I want to do is display a messagebox. I tried using[/color][/color]
        Messagebox.Show ,[color=blue][color=green]
        > > and get an error that Messagebox has not been declared. I tried using
        > > MsgBox (like we used in VB 6) but this throws application errors every[/color]
        > time[color=green]
        > > I run it I get the error "It is in valid to show a modal or form when[/color][/color]
        the[color=blue][color=green]
        > > application is not running in UserInteractive mode. Specify the
        > > ServiceNotifica tion or DefaultDesktopO nly style to display a notice[/color][/color]
        from[color=blue]
        > a[color=green]
        > > service application" I tried Response.Write, which just puts the[/color][/color]
        message[color=blue]
        > in[color=green]
        > > the background of my web page, not popping up like a REAL MsgBox![/color][/color]
        Please[color=blue][color=green]
        > > help with this, this should be SIMPLE!!! TIA
        > >
        > > Coleen
        > >
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • Jan Tielens

          #5
          Re: Dumb question about Message boxes

          If you are writing a web application (e.g. Webform), then the System.Windows
          namespace is not available. This namespace is meant for WindowsForms
          applications.

          Jan
          "Coleen" <coleenholley@y ahoo.com> schreef in bericht
          news:ukvEoJeuDH A.1196@TK2MSFTN GP12.phx.gbl...[color=blue]
          > When I put System.Windows. Forms in the Namespace I get the blue squiggly
          > line with the message "Namespace or type 'forms' for the Imports
          > 'System.Windows .forms' cannot be found. What's up with that? Usually,[/color]
          when[color=blue]
          > you put in the Namespace, the choices pop-up after you type the . but in
          > this case, Windows does not come up as one of the available choices under
          > System! How can I put in a Namespace when it is not available or[/color]
          supported?[color=blue]
          >
          > "Norman Yuan" <normanyuan@Rem oveThis.shaw.ca > wrote in message
          > news:ccszb.5493 86$6C4.180063@p d7tw1no...[color=green]
          > > It seems that you are talking about Web app. Do you really want to show[/color][/color]
          a[color=blue][color=green]
          > > MessageBox on the web server, while user sits in front of a web browser
          > > thousands kilometers away? How does the user know a MessageBox pops up[/color][/color]
          on[color=blue][color=green]
          > > the web server? In Web app, if you want to nitify user something, you[/color]
          > should[color=green]
          > > have the web server send back a page to user, either in the same browser
          > > window or in a new browser window.
          > >
          > > By the way, MessageBox is in System.Windows. Forms namespace, which is[/color][/color]
          not[color=blue][color=green]
          > > referenced in web app by default. That is why you get error "Not[/color]
          > declared".[color=green]
          > >
          > >
          > > "Coleen" <coleenholley@y ahoo.com> wrote in message
          > > news:OCUj0dduDH A.424@TK2MSFTNG P11.phx.gbl...[color=darkred]
          > > > I'm using MS .Net Version 7, using VB .Net working on a "simple" web[/color][/color]
          > page.[color=green][color=darkred]
          > > > All I want to do is display a messagebox. I tried using[/color][/color]
          > Messagebox.Show ,[color=green][color=darkred]
          > > > and get an error that Messagebox has not been declared. I tried using
          > > > MsgBox (like we used in VB 6) but this throws application errors every[/color]
          > > time[color=darkred]
          > > > I run it I get the error "It is in valid to show a modal or form when[/color][/color]
          > the[color=green][color=darkred]
          > > > application is not running in UserInteractive mode. Specify the
          > > > ServiceNotifica tion or DefaultDesktopO nly style to display a notice[/color][/color]
          > from[color=green]
          > > a[color=darkred]
          > > > service application" I tried Response.Write, which just puts the[/color][/color]
          > message[color=green]
          > > in[color=darkred]
          > > > the background of my web page, not popping up like a REAL MsgBox![/color][/color]
          > Please[color=green][color=darkred]
          > > > help with this, this should be SIMPLE!!! TIA
          > > >
          > > > Coleen
          > > >
          > > >
          > > >[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Michael Lang

            #6
            Re: Dumb question about Message boxes

            "Coleen" <coleenholley@y ahoo.com> wrote in
            news:ukvEoJeuDH A.1196@TK2MSFTN GP12.phx.gbl:
            [color=blue]
            > When I put System.Windows. Forms in the Namespace I get the blue
            > squiggly line with the message "Namespace or type 'forms' for the
            > Imports 'System.Windows .forms' cannot be found. What's up with that?
            > Usually, when you put in the Namespace, the choices pop-up after you
            > type the . but in this case, Windows does not come up as one of the
            > available choices under System! How can I put in a Namespace when it
            > is not available or supported?[/color]

            Adding a "using" or "Imports" statement at the top of the code file is not
            the same as ading a reference. To add a reference use the project
            explorer. Right-click on the "references " folder as select "Add
            reference..." Then browse for "System.Windows .Forms".

            When you create a "Windows Forms Application" in the new project wizard it
            does this or you. On the other hand you should not be using windows forms
            in a web application, which is why that reference is not made.

            What you want is a scripting message box. It will appear on the client
            side of the web page. I have not made one in ASP.NET, but it won't be that
            different from ASP.

            See the following link. It shows how to do it with both Javascript and
            VBscript:



            Michael Lang

            Comment

            • Coleen

              #7
              Re: Dumb question about Message boxes

              Thank you! I was just informed by one of my co-workers that I would need to
              do my form validation using JavaScript - unfortunately I have NO knowledge
              of JavaScript, so this is good news that I can do it in VB Script! Thanks
              :-)

              "Michael Lang" <ml@nospam.co m> wrote in message
              news:Xns94469EB 22AC7lang1474ic qmailcom@207.46 .248.16...[color=blue]
              > "Coleen" <coleenholley@y ahoo.com> wrote in
              > news:ukvEoJeuDH A.1196@TK2MSFTN GP12.phx.gbl:
              >[color=green]
              > > When I put System.Windows. Forms in the Namespace I get the blue
              > > squiggly line with the message "Namespace or type 'forms' for the
              > > Imports 'System.Windows .forms' cannot be found. What's up with that?
              > > Usually, when you put in the Namespace, the choices pop-up after you
              > > type the . but in this case, Windows does not come up as one of the
              > > available choices under System! How can I put in a Namespace when it
              > > is not available or supported?[/color]
              >
              > Adding a "using" or "Imports" statement at the top of the code file is not
              > the same as ading a reference. To add a reference use the project
              > explorer. Right-click on the "references " folder as select "Add
              > reference..." Then browse for "System.Windows .Forms".
              >
              > When you create a "Windows Forms Application" in the new project wizard it
              > does this or you. On the other hand you should not be using windows forms
              > in a web application, which is why that reference is not made.
              >
              > What you want is a scripting message box. It will appear on the client
              > side of the web page. I have not made one in ASP.NET, but it won't be[/color]
              that[color=blue]
              > different from ASP.
              >
              > See the following link. It shows how to do it with both Javascript and
              > VBscript:
              >
              > http://www.javascriptkit.com/javatutors/vbalert.shtml
              >
              > Michael Lang[/color]


              Comment

              • Scott M.

                #8
                Re: Dumb question about Message boxes

                But you really shouldn't do it in VBScript, since Netscape browsers don't
                support VBScript.

                In a nutshell Colleen, it wasn't that different in Classic ASP. You
                couldn't ask for a msgbox() in classic ASP either because message boxes are
                not produced by the server, they are produced by the browser. Since
                server-side code executes, well at the server, asking for a messagebox is
                out of the question. All requests for messageboxes/alerts must be made at
                the client level.


                "Coleen" <coleenholley@y ahoo.com> wrote in message
                news:OLXTxbeuDH A.3496@TK2MSFTN GP11.phx.gbl...[color=blue]
                > Thank you! I was just informed by one of my co-workers that I would need[/color]
                to[color=blue]
                > do my form validation using JavaScript - unfortunately I have NO knowledge
                > of JavaScript, so this is good news that I can do it in VB Script! Thanks
                > :-)
                >
                > "Michael Lang" <ml@nospam.co m> wrote in message
                > news:Xns94469EB 22AC7lang1474ic qmailcom@207.46 .248.16...[color=green]
                > > "Coleen" <coleenholley@y ahoo.com> wrote in
                > > news:ukvEoJeuDH A.1196@TK2MSFTN GP12.phx.gbl:
                > >[color=darkred]
                > > > When I put System.Windows. Forms in the Namespace I get the blue
                > > > squiggly line with the message "Namespace or type 'forms' for the
                > > > Imports 'System.Windows .forms' cannot be found. What's up with that?
                > > > Usually, when you put in the Namespace, the choices pop-up after you
                > > > type the . but in this case, Windows does not come up as one of the
                > > > available choices under System! How can I put in a Namespace when it
                > > > is not available or supported?[/color]
                > >
                > > Adding a "using" or "Imports" statement at the top of the code file is[/color][/color]
                not[color=blue][color=green]
                > > the same as ading a reference. To add a reference use the project
                > > explorer. Right-click on the "references " folder as select "Add
                > > reference..." Then browse for "System.Windows .Forms".
                > >
                > > When you create a "Windows Forms Application" in the new project wizard[/color][/color]
                it[color=blue][color=green]
                > > does this or you. On the other hand you should not be using windows[/color][/color]
                forms[color=blue][color=green]
                > > in a web application, which is why that reference is not made.
                > >
                > > What you want is a scripting message box. It will appear on the client
                > > side of the web page. I have not made one in ASP.NET, but it won't be[/color]
                > that[color=green]
                > > different from ASP.
                > >
                > > See the following link. It shows how to do it with both Javascript and
                > > VBscript:
                > >
                > > http://www.javascriptkit.com/javatutors/vbalert.shtml
                > >
                > > Michael Lang[/color]
                >
                >[/color]


                Comment

                • Coleen

                  #9
                  Re: Dumb question about Message boxes

                  Which is fine and dandy, if you know JavaScript, but I don't! So I am
                  looking for an alternative. If I have to use JavaScript, then I have to,
                  but do you have any suggestions for a VERY beginner? I have no idea even
                  where to start. Where do I write the code? In the aspx portion, or the
                  code behind? I haven't a clue... Thanks for any suggestions :-)

                  "Scott M." <s-mar@BADSPAMsnet .net> wrote in message
                  news:OcEmaRhuDH A.1596@TK2MSFTN GP10.phx.gbl...[color=blue]
                  > But you really shouldn't do it in VBScript, since Netscape browsers don't
                  > support VBScript.
                  >
                  > In a nutshell Colleen, it wasn't that different in Classic ASP. You
                  > couldn't ask for a msgbox() in classic ASP either because message boxes[/color]
                  are[color=blue]
                  > not produced by the server, they are produced by the browser. Since
                  > server-side code executes, well at the server, asking for a messagebox is
                  > out of the question. All requests for messageboxes/alerts must be made at
                  > the client level.
                  >
                  >
                  > "Coleen" <coleenholley@y ahoo.com> wrote in message
                  > news:OLXTxbeuDH A.3496@TK2MSFTN GP11.phx.gbl...[color=green]
                  > > Thank you! I was just informed by one of my co-workers that I would[/color][/color]
                  need[color=blue]
                  > to[color=green]
                  > > do my form validation using JavaScript - unfortunately I have NO[/color][/color]
                  knowledge[color=blue][color=green]
                  > > of JavaScript, so this is good news that I can do it in VB Script![/color][/color]
                  Thanks[color=blue][color=green]
                  > > :-)
                  > >
                  > > "Michael Lang" <ml@nospam.co m> wrote in message
                  > > news:Xns94469EB 22AC7lang1474ic qmailcom@207.46 .248.16...[color=darkred]
                  > > > "Coleen" <coleenholley@y ahoo.com> wrote in
                  > > > news:ukvEoJeuDH A.1196@TK2MSFTN GP12.phx.gbl:
                  > > >
                  > > > > When I put System.Windows. Forms in the Namespace I get the blue
                  > > > > squiggly line with the message "Namespace or type 'forms' for the
                  > > > > Imports 'System.Windows .forms' cannot be found. What's up with[/color][/color][/color]
                  that?[color=blue][color=green][color=darkred]
                  > > > > Usually, when you put in the Namespace, the choices pop-up after you
                  > > > > type the . but in this case, Windows does not come up as one of the
                  > > > > available choices under System! How can I put in a Namespace when[/color][/color][/color]
                  it[color=blue][color=green][color=darkred]
                  > > > > is not available or supported?
                  > > >
                  > > > Adding a "using" or "Imports" statement at the top of the code file is[/color][/color]
                  > not[color=green][color=darkred]
                  > > > the same as ading a reference. To add a reference use the project
                  > > > explorer. Right-click on the "references " folder as select "Add
                  > > > reference..." Then browse for "System.Windows .Forms".
                  > > >
                  > > > When you create a "Windows Forms Application" in the new project[/color][/color][/color]
                  wizard[color=blue]
                  > it[color=green][color=darkred]
                  > > > does this or you. On the other hand you should not be using windows[/color][/color]
                  > forms[color=green][color=darkred]
                  > > > in a web application, which is why that reference is not made.
                  > > >
                  > > > What you want is a scripting message box. It will appear on the[/color][/color][/color]
                  client[color=blue][color=green][color=darkred]
                  > > > side of the web page. I have not made one in ASP.NET, but it won't be[/color]
                  > > that[color=darkred]
                  > > > different from ASP.
                  > > >
                  > > > See the following link. It shows how to do it with both Javascript[/color][/color][/color]
                  and[color=blue][color=green][color=darkred]
                  > > > VBscript:
                  > > >
                  > > > http://www.javascriptkit.com/javatutors/vbalert.shtml
                  > > >
                  > > > Michael Lang[/color]
                  > >
                  > >[/color]
                  >
                  >[/color]


                  Comment

                  • Scott M.

                    #10
                    Re: Dumb question about Message boxes

                    See my other post...

                    JavaScript IS the answer you are looking for. In today's world of web
                    development, JavaScript is a must know.


                    "Coleen" <coleenholley@y ahoo.com> wrote in message
                    news:eGxvmVpuDH A.2168@TK2MSFTN GP10.phx.gbl...[color=blue]
                    > Which is fine and dandy, if you know JavaScript, but I don't! So I am
                    > looking for an alternative. If I have to use JavaScript, then I have to,
                    > but do you have any suggestions for a VERY beginner? I have no idea even
                    > where to start. Where do I write the code? In the aspx portion, or the
                    > code behind? I haven't a clue... Thanks for any suggestions :-)
                    >
                    > "Scott M." <s-mar@BADSPAMsnet .net> wrote in message
                    > news:OcEmaRhuDH A.1596@TK2MSFTN GP10.phx.gbl...[color=green]
                    > > But you really shouldn't do it in VBScript, since Netscape browsers[/color][/color]
                    don't[color=blue][color=green]
                    > > support VBScript.
                    > >
                    > > In a nutshell Colleen, it wasn't that different in Classic ASP. You
                    > > couldn't ask for a msgbox() in classic ASP either because message boxes[/color]
                    > are[color=green]
                    > > not produced by the server, they are produced by the browser. Since
                    > > server-side code executes, well at the server, asking for a messagebox[/color][/color]
                    is[color=blue][color=green]
                    > > out of the question. All requests for messageboxes/alerts must be made[/color][/color]
                    at[color=blue][color=green]
                    > > the client level.
                    > >
                    > >
                    > > "Coleen" <coleenholley@y ahoo.com> wrote in message
                    > > news:OLXTxbeuDH A.3496@TK2MSFTN GP11.phx.gbl...[color=darkred]
                    > > > Thank you! I was just informed by one of my co-workers that I would[/color][/color]
                    > need[color=green]
                    > > to[color=darkred]
                    > > > do my form validation using JavaScript - unfortunately I have NO[/color][/color]
                    > knowledge[color=green][color=darkred]
                    > > > of JavaScript, so this is good news that I can do it in VB Script![/color][/color]
                    > Thanks[color=green][color=darkred]
                    > > > :-)
                    > > >
                    > > > "Michael Lang" <ml@nospam.co m> wrote in message
                    > > > news:Xns94469EB 22AC7lang1474ic qmailcom@207.46 .248.16...
                    > > > > "Coleen" <coleenholley@y ahoo.com> wrote in
                    > > > > news:ukvEoJeuDH A.1196@TK2MSFTN GP12.phx.gbl:
                    > > > >
                    > > > > > When I put System.Windows. Forms in the Namespace I get the blue
                    > > > > > squiggly line with the message "Namespace or type 'forms' for the
                    > > > > > Imports 'System.Windows .forms' cannot be found. What's up with[/color][/color]
                    > that?[color=green][color=darkred]
                    > > > > > Usually, when you put in the Namespace, the choices pop-up after[/color][/color][/color]
                    you[color=blue][color=green][color=darkred]
                    > > > > > type the . but in this case, Windows does not come up as one of[/color][/color][/color]
                    the[color=blue][color=green][color=darkred]
                    > > > > > available choices under System! How can I put in a Namespace when[/color][/color]
                    > it[color=green][color=darkred]
                    > > > > > is not available or supported?
                    > > > >
                    > > > > Adding a "using" or "Imports" statement at the top of the code file[/color][/color][/color]
                    is[color=blue][color=green]
                    > > not[color=darkred]
                    > > > > the same as ading a reference. To add a reference use the project
                    > > > > explorer. Right-click on the "references " folder as select "Add
                    > > > > reference..." Then browse for "System.Windows .Forms".
                    > > > >
                    > > > > When you create a "Windows Forms Application" in the new project[/color][/color]
                    > wizard[color=green]
                    > > it[color=darkred]
                    > > > > does this or you. On the other hand you should not be using windows[/color]
                    > > forms[color=darkred]
                    > > > > in a web application, which is why that reference is not made.
                    > > > >
                    > > > > What you want is a scripting message box. It will appear on the[/color][/color]
                    > client[color=green][color=darkred]
                    > > > > side of the web page. I have not made one in ASP.NET, but it won't[/color][/color][/color]
                    be[color=blue][color=green][color=darkred]
                    > > > that
                    > > > > different from ASP.
                    > > > >
                    > > > > See the following link. It shows how to do it with both Javascript[/color][/color]
                    > and[color=green][color=darkred]
                    > > > > VBscript:
                    > > > >
                    > > > > http://www.javascriptkit.com/javatutors/vbalert.shtml
                    > > > >
                    > > > > Michael Lang
                    > > >
                    > > >[/color]
                    > >
                    > >[/color]
                    >
                    >[/color]


                    Comment

                    Working...