有没有人可以帮我解决这个例外 [英] Could anyone please help me in this exception

查看:61
本文介绍了有没有人可以帮我解决这个例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直致力于与vb.net一起使用JavaScript,我正在尝试在vb.net windows应用程序中合并java脚本代码。



在脚本中我试图调用函数警告hello()按钮点击动作



我得到的例外是属性不是systems.windows.forms.button的成员



下面是我在应用程序中使用的代码



我尝试过:



Private Sub Form1_Load(ByVal sender As System .Object,ByVal e As System.EventArgs)处理MyBase.Load

Page.RegisterStartupScript(MyScript,_

< script language = javascript>& _

function AlertHello(){alert('Hello ASP.NET');}< / script>)



Button1 .Attributes(onclick)=AlertHello()

Button2.Attributes(onclick)=AlertHello()

End Sub

解决方案

根本不可能,两者都是不同的平台

使用 MessageBox.Show() to迪展开警报框。

如果你想在服务器端运行javascript然后查看 Node.js [ ^ ]


嗯。

您是否意识到WinForms应用程序没有页面,不在浏览器中运行,并且与Javascript或脚本无关?



你在哪里知道你可以从网站上提取基于网络的代码,它可以在你的基于Windows的应用程序中运行吗?


昨天你被告知< a href =http://www.codeproject.com/Questions/1125033/Need-to-send-a-value-on-button-click-event-using-j> http://www.codeproject.com / Questions / 1125033 /需要发送按钮点击事件使用j的值 [ ^ ]这是不可能的。

I have been working on "Using JavaScript Along with vb.net" where i'm trying to incorporate java script code in vb.net windows application.

in the script i'm trying to invoke a function Alert hello() on button click action

the exception i'm getting is Attributes is not a member of systems.windows.forms.button

below is the code i'm using in the application

What I have tried:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Page.RegisterStartupScript("MyScript", _
"<script language=javascript>" & _
"function AlertHello() { alert('Hello ASP.NET'); }</script>")

Button1.Attributes("onclick") = "AlertHello()"
Button2.Attributes("onclick") = "AlertHello()"
End Sub

解决方案

Not Possible at all, both are of different platforms
use MessageBox.Show() to display the alert box.
if you want to run javascript in server side then look into Node.js[^]


Um.
You do realize that WinForms apps don't have "pages", don't run in a browser, and have nothing to do with Javascript or scripts in general?

Where did you get the idea that you could just lift web-based code from a site and it would work in your Windows based application?


you were told yesterday at http://www.codeproject.com/Questions/1125033/Need-to-send-a-value-on-button-click-event-using-j[^] that this is not possible.


这篇关于有没有人可以帮我解决这个例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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