如何将VBScript更改为文件后面的VB代码 [英] How to change VBScript to VB code behind file

查看:71
本文介绍了如何将VBScript更改为文件后面的VB代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我需要一个弹出窗口供用户确认更改。默认按钮是

秒选项(否)。由于用户只使用IE,我认为VBScript是一个

选项。以下代码仅适用于html按钮。我想知道我怎么能把b $ b改成后面的VB代码并使用服务器控件。


谢谢。


< script language =" VBScript">

Sub cmdDelete()

Dim vbResponse

vbResponse = MsgBox(" are你确定要删除吗?",vbYesNo +

vbCritical + vbDefaultButton2," Title")


如果vbResponse = vbYes那么

''做点什么

否则

''Label1.Text ="不要删除"

结束如果

结束子

< / script>

解决方案

唯一的方法就是你控制输出你有的javascript

那里。


后面的VBScript和VB.NET代码 - 没有任何关系。前者是客户端脚本语言的
,而后者是服务器端编译的

语言。没关系。


你的VB.NET必须生成这个VBScript代码才能运行。


" Sean" < SS **** @ yahoo.com>在消息中写道

新闻:O8 ************** @ tk2msftngp13.phx.gbl ...


我需要一个弹出窗口供用户确认更改。默认按钮是
第二个选项(否)。由于用户只使用IE,我认为VBScript是一个
选项。以下代码仅适用于html按钮。我想知道如何将其更改为文件后面的VB代码并使用服务器控件。

谢谢。

< script language =" VBScript"> ;
Sub cmdDelete()
Dim vbResponse
vbResponse = MsgBox(你确定要删除吗?,vbYesNo +
vbCritical + vbDefaultButton2," Title")

如果vbResponse = vbYes那么
''做点什么
'
''Label1.Text ="不做删除>
结束如果<结束分
< / script>



Marina,


感谢您的回复。


如果我是正确的,javascript不允许我将默认按钮设置为

第二个选项(例如否)。如果VBScript在这里不起作用,在这种情况下,我实现了什么

选项?


感谢您的输入。


" Marina" < ZL ******* @ nospam.hotmail.com>在消息中写道

新闻:OJ ************** @ TK2MSFTNGP10.phx.gbl ...

唯一的办法那就是,如果你控制输出你的
那里的javascript。

后面的VBScript和VB.NET代码 - 没有任何关系。前
是客户端脚本语言,而后者是服务器端
编译语言。没关系。

你的VB.NET必须生成这个VBScript代码才能运行。

Sean < SS **** @ yahoo.com>在消息中写道
新闻:O8 ************** @ tk2msftngp13.phx.gbl ...


我需要一个弹出窗口供用户确认更改。默认按钮是


第二个选项(否)。由于用户只使用IE,我认为VBScript是一个
选项。以下代码仅适用于html按钮。我想知道我
如何将它改为文件后面的VB代码并使用服务器控件。

谢谢。

< script language =" VBScript"> ;
Sub cmdDelete()
Dim vbResponse
vbResponse = MsgBox(你确定要删除吗?,vbYesNo +
vbCritical + vbDefaultButton2," Title")

如果vbResponse = vbYes那么
''做点什么
'
''Label1.Text ="不做删除>
结束如果<结束分
< / script>




嗨Sean,

我在这个例子中使用了一个带有一个文本框和两个按钮的webform

(名为Buttonyes和ButtonNo。)

Private Sub Page_Load(ByVal sender)作为System.Object,ByVal e As

System.EventArgs)处理MyBase.Load

TextBox1.Text =你确定要删除吗?

结束子


私人苏b ButtonNo_Click(ByVal sender As Object,ByVal e As

System.EventArgs)处理ButtonNo.Click

TextBox1.Text =做点什么

End Sub


Private Sub Buttonyes_Click(ByVal sender As Object,ByVal e As

System.EventArgs)处理Buttonyes.Click

TextBox1.Text ="不要删除"

结束子

了解自己的工作方式

Cor

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="VBScript">
Sub cmdDelete()
Dim vbResponse
vbResponse = MsgBox("are you sure you want to delete?", vbYesNo +
vbCritical+ vbDefaultButton2, "Title")

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

解决方案

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" <ss****@yahoo.com> wrote in message
news:O8**************@tk2msftngp13.phx.gbl...

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="VBScript">
Sub cmdDelete()
Dim vbResponse
vbResponse = MsgBox("are you sure you want to delete?", vbYesNo +
vbCritical+ vbDefaultButton2, "Title")

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



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" <zl*******@nospam.hotmail.com> wrote in message
news:OJ**************@TK2MSFTNGP10.phx.gbl...

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" <ss****@yahoo.com> wrote in message
news:O8**************@tk2msftngp13.phx.gbl...

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="VBScript">
Sub cmdDelete()
Dim vbResponse
vbResponse = MsgBox("are you sure you want to delete?", vbYesNo +
vbCritical+ vbDefaultButton2, "Title")

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




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.EventArgs) 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.EventArgs) Handles ButtonNo.Click
TextBox1.Text = "do something"
End Sub

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


这篇关于如何将VBScript更改为文件后面的VB代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆