How to change VBScript to VB code behind file

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

    How to change VBScript to VB code behind file

    Hi,

    I need a pop-up window for user to confirm change. The default button is the
    second option (No). As the user only use IE, I think the VBScript is an
    option. The following code only works for html button. I wonder how I can
    change it to VB code behind file and use a server control.

    Thanks.

    <script language="VBScr ipt">
    Sub cmdDelete()
    Dim vbResponse
    vbResponse = MsgBox("are you sure you want to delete?", vbYesNo +
    vbCritical+ vbDefaultButton 2, "Title")

    If vbResponse = vbYes Then
    ' do something
    Else
    ' Label1.Text = "do not do delete"
    End If
    End Sub
    </script>


  • Marina

    #2
    Re: How to change VBScript to VB code behind file

    The only way to do that, is if you controls outputs the javascript you have
    there.

    VBScript and VB.NET code behind - are not related in any way. The former is
    a client side scripting language, while the latter is a server side compiled
    language. No relation.

    Your VB.NET would have to generated this VBScript code, for it to run.

    "Sean" <ssmith@yahoo.c om> wrote in message
    news:O8vFEYaYDH A.3924@tk2msftn gp13.phx.gbl...[color=blue]
    > Hi,
    >
    > I need a pop-up window for user to confirm change. The default button is[/color]
    the[color=blue]
    > second option (No). As the user only use IE, I think the VBScript is an
    > option. The following code only works for html button. I wonder how I can
    > change it to VB code behind file and use a server control.
    >
    > Thanks.
    >
    > <script language="VBScr ipt">
    > Sub cmdDelete()
    > Dim vbResponse
    > vbResponse = MsgBox("are you sure you want to delete?", vbYesNo +
    > vbCritical+ vbDefaultButton 2, "Title")
    >
    > If vbResponse = vbYes Then
    > ' do something
    > Else
    > ' Label1.Text = "do not do delete"
    > End If
    > End Sub
    > </script>
    >
    >[/color]


    Comment

    • Sean

      #3
      Re: How to change VBScript to VB code behind file

      Marina,

      Thanks for your reply.

      If I am correct, javascript doesn't allow me to set the default button to
      the 2nd option (e.g. No.). If VBScript doesn't work here, in this case, what
      option do I have for implementation?

      Thanks for your input.



      "Marina" <zlatkinam@nosp am.hotmail.com> wrote in message
      news:OJ1d1aaYDH A.2236@TK2MSFTN GP10.phx.gbl...[color=blue]
      > The only way to do that, is if you controls outputs the javascript you[/color]
      have[color=blue]
      > there.
      >
      > VBScript and VB.NET code behind - are not related in any way. The former[/color]
      is[color=blue]
      > a client side scripting language, while the latter is a server side[/color]
      compiled[color=blue]
      > language. No relation.
      >
      > Your VB.NET would have to generated this VBScript code, for it to run.
      >
      > "Sean" <ssmith@yahoo.c om> wrote in message
      > news:O8vFEYaYDH A.3924@tk2msftn gp13.phx.gbl...[color=green]
      > > Hi,
      > >
      > > I need a pop-up window for user to confirm change. The default button is[/color]
      > the[color=green]
      > > second option (No). As the user only use IE, I think the VBScript is an
      > > option. The following code only works for html button. I wonder how I[/color][/color]
      can[color=blue][color=green]
      > > change it to VB code behind file and use a server control.
      > >
      > > Thanks.
      > >
      > > <script language="VBScr ipt">
      > > Sub cmdDelete()
      > > Dim vbResponse
      > > vbResponse = MsgBox("are you sure you want to delete?", vbYesNo +
      > > vbCritical+ vbDefaultButton 2, "Title")
      > >
      > > If vbResponse = vbYes Then
      > > ' do something
      > > Else
      > > ' Label1.Text = "do not do delete"
      > > End If
      > > End Sub
      > > </script>
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Cor

        #4
        Re: How to change VBScript to VB code behind file

        Hi Sean,
        I used for this example a webform with one textbox and two buttons on it
        (named Buttonyes and ButtonNo.)
        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
        System.EventArg s) Handles MyBase.Load
        TextBox1.Text = "are you sure you want to delete?"
        End Sub

        Private Sub ButtonNo_Click( ByVal sender As Object, ByVal e As
        System.EventArg s) Handles ButtonNo.Click
        TextBox1.Text = "do something"
        End Sub

        Private Sub Buttonyes_Click (ByVal sender As Object, ByVal e As
        System.EventArg s) Handles Buttonyes.Click
        TextBox1.Text = "do not delete"
        End Sub
        See yourself how it works
        Cor


        Comment

        • James Zhuo

          #5
          Re: How to change VBScript to VB code behind file


          "Marina" <zlatkinam@nosp am.hotmail.com> wrote in message
          news:OJ1d1aaYDH A.2236@TK2MSFTN GP10.phx.gbl...[color=blue]
          > The only way to do that, is if you controls outputs the javascript you[/color]
          have[color=blue]
          > there.
          >
          > VBScript and VB.NET code behind - are not related in any way. The former[/color]
          is[color=blue]
          > a client side scripting language, while the latter is a server side[/color]
          compiled[color=blue]
          > language. No relation.[/color]

          Well, VBScript is used for ASP, so it's not necessarily used on the client
          side.

          I think you can reuse that code, only that you have to bind it to the
          control/button
          that you want to use.

          [color=blue]
          >
          > Your VB.NET would have to generated this VBScript code, for it to run.
          >
          > "Sean" <ssmith@yahoo.c om> wrote in message
          > news:O8vFEYaYDH A.3924@tk2msftn gp13.phx.gbl...[color=green]
          > > Hi,
          > >
          > > I need a pop-up window for user to confirm change. The default button is[/color]
          > the[color=green]
          > > second option (No). As the user only use IE, I think the VBScript is an
          > > option. The following code only works for html button. I wonder how I[/color][/color]
          can[color=blue][color=green]
          > > change it to VB code behind file and use a server control.
          > >
          > > Thanks.
          > >
          > > <script language="VBScr ipt">
          > > Sub cmdDelete()
          > > Dim vbResponse
          > > vbResponse = MsgBox("are you sure you want to delete?", vbYesNo +
          > > vbCritical+ vbDefaultButton 2, "Title")
          > >
          > > If vbResponse = vbYes Then
          > > ' do something
          > > Else
          > > ' Label1.Text = "do not do delete"
          > > End If
          > > End Sub
          > > </script>
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Armin Zingler

            #6
            Re: How to change VBScript to VB code behind file

            "Sean" <ssmith@yahoo.c om> schrieb[color=blue]
            > I need a pop-up window for user to confirm change. The default button
            > is the second option (No). As the user only use IE, I think the
            > VBScript is an option. The following code only works for html button.
            > I wonder how I can change it to VB code behind file and use a server
            > control.[/color]

            I don't know VBScript. Please don't post to a VB.NET group. Thanks.


            --
            Armin

            Comment

            • Cor

              #7
              Re: How to change VBScript to VB code behind file

              Armin,
              What does my code have to do with VB Script, it is VB.net 2003
              Cor


              Comment

              • Sean

                #8
                Re: How to change VBScript to VB code behind file

                How can I bind it to a control/button, then?
                I tried Button1.Attribu tes.Add("onclic k", "VBscriptFuncti onName();") in
                Page_Load, but it is not working either.

                Thanks.

                "James Zhuo" <nano_electroni cs@optusnet.com .au> wrote in message
                news:eu4W0KbYDH A.1900@TK2MSFTN GP10.phx.gbl...[color=blue]
                >
                > "Marina" <zlatkinam@nosp am.hotmail.com> wrote in message
                > news:OJ1d1aaYDH A.2236@TK2MSFTN GP10.phx.gbl...[color=green]
                > > The only way to do that, is if you controls outputs the javascript you[/color]
                > have[color=green]
                > > there.
                > >
                > > VBScript and VB.NET code behind - are not related in any way. The[/color][/color]
                former[color=blue]
                > is[color=green]
                > > a client side scripting language, while the latter is a server side[/color]
                > compiled[color=green]
                > > language. No relation.[/color]
                >
                > Well, VBScript is used for ASP, so it's not necessarily used on the client
                > side.
                >
                > I think you can reuse that code, only that you have to bind it to the
                > control/button
                > that you want to use.
                >
                >[color=green]
                > >
                > > Your VB.NET would have to generated this VBScript code, for it to run.
                > >
                > > "Sean" <ssmith@yahoo.c om> wrote in message
                > > news:O8vFEYaYDH A.3924@tk2msftn gp13.phx.gbl...[color=darkred]
                > > > Hi,
                > > >
                > > > I need a pop-up window for user to confirm change. The default button[/color][/color][/color]
                is[color=blue][color=green]
                > > the[color=darkred]
                > > > second option (No). As the user only use IE, I think the VBScript is[/color][/color][/color]
                an[color=blue][color=green][color=darkred]
                > > > option. The following code only works for html button. I wonder how I[/color][/color]
                > can[color=green][color=darkred]
                > > > change it to VB code behind file and use a server control.
                > > >
                > > > Thanks.
                > > >
                > > > <script language="VBScr ipt">
                > > > Sub cmdDelete()
                > > > Dim vbResponse
                > > > vbResponse = MsgBox("are you sure you want to delete?", vbYesNo +
                > > > vbCritical+ vbDefaultButton 2, "Title")
                > > >
                > > > If vbResponse = vbYes Then
                > > > ' do something
                > > > Else
                > > > ' Label1.Text = "do not do delete"
                > > > End If
                > > > End Sub
                > > > </script>
                > > >
                > > >[/color]
                > >
                > >[/color]
                >
                >[/color]


                Comment

                • Armin Zingler

                  #9
                  Re: How to change VBScript to VB code behind file

                  "Cor" <non@non.com> schrieb[color=blue]
                  > Armin,
                  > What does my code have to do with VB Script, it is VB.net 2003
                  > Cor[/color]

                  I did not read your code. I replied to Sean and my replay shows up as an
                  answer to Sean, so I don't see your problem.


                  --
                  Armin

                  Comment

                  • Cor

                    #10
                    Re: How to change VBScript to VB code behind file

                    Armin,
                    His qeustion was how he could use VB code behind, that you make with a
                    VB.net Asp.Net webapplication.
                    The asp.net server has slightly to do with that.
                    Cor


                    Comment

                    • Armin Zingler

                      #11
                      Re: How to change VBScript to VB code behind file

                      "Armin Zingler" <az.nospam@free net.de> schrieb[color=blue]
                      > "Cor" <non@non.com> schrieb[color=green]
                      > > Armin,
                      > > What does my code have to do with VB Script, it is VB.net 2003
                      > > Cor[/color]
                      >
                      > I did not read your code. I replied to Sean and my replay shows up as[/color]

                      .... my reply, not replay... *g*
                      [color=blue]
                      > an answer to Sean, so I don't see your problem.[/color]


                      --
                      Armin

                      Comment

                      • Herfried K. Wagner [MVP]

                        #12
                        Re: How to change VBScript to VB code behind file

                        Hello,

                        "Cor" <non@non.com> schrieb:[color=blue]
                        > His qeustion was how he could use VB code behind, that you make with a
                        > VB.net Asp.Net webapplication.
                        > The asp.net server has slightly to do with that.[/color]

                        ???

                        He posted some VBScript code:

                        | <script language="VBScr ipt">

                        No relation to VB .NET programming.

                        HTH,
                        Herfried K. Wagner
                        --
                        MVP ยท VB Classic, VB .NET
                        Die Website von H. Wagner zu .NET, Visual Basic .NET und Classic Visual Basic.



                        Comment

                        • Armin Zingler

                          #13
                          Re: How to change VBScript to VB code behind file

                          "Cor" <non@non.com> schrieb[color=blue]
                          > Armin,
                          > His qeustion was how he could use VB code behind, that you make with
                          > a VB.net Asp.Net webapplication.
                          > The asp.net server has slightly to do with that.[/color]

                          Neither I replied to your posting, nor I mentioned asp.net server.

                          Apart from that, he mentioned "code behind" and "server control". I don't
                          know these terms - probably because they are not VB.NET related?

                          If you have a problem with me, simply ignore me. Most people didn't have one
                          in the past.


                          --
                          Armin

                          Comment

                          • Cor

                            #14
                            Re: How to change VBScript to VB code behind file


                            Armin,
                            In contraire to that I love your discussions now I understand it better, you
                            saw what I wrote to the Hirc.
                            But for me it is strange that everything about the vb.net asp applications
                            or webservices is send away to other groups.
                            That while in my opinion total .Net is more or less the normal successor
                            from the VB6 IIS application (the webclass).
                            Cor


                            Comment

                            • Rick

                              #15
                              Re: How to change VBScript to VB code behind file

                              They are ASP.NET terms. This is not a VB.NET newsgroup, the title of the
                              group is "dotnet.general ". Id say that ASP.NET falls into that category?


                              "Armin Zingler" <az.nospam@free net.de> wrote in message
                              news:eJ$bV$bYDH A.1900@TK2MSFTN GP10.phx.gbl...[color=blue]
                              > "Cor" <non@non.com> schrieb[/color]
                              [color=blue]
                              > Apart from that, he mentioned "code behind" and "server control". I don't
                              > know these terms - probably because they are not VB.NET related?[/color]
                              [color=blue]
                              > Armin
                              >[/color]


                              Comment

                              Working...