且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用按钮打开网址

更新时间:2023-11-27 21:47:46

该代码本身不会打开任何东西 - 它只是将一个URL作为字符串返回到您调用它的任何方法,并且将使用该字符串打开URL,可能是通过 Process.St art 方法。



我首先在Return语句上放置一个断点,然后在调试器中运行你的代码。当它到达断点时,它将停止,您可以使用调用堆栈窗格追溯代码以查看它对字符串执行的操作。几乎可以肯定的是,你在某个地方循环调用contains方法。



对不起,我们不能为你做任何 - 我们无法访问你的机器或你的源代码!





BTW:如果这是一个与web相关的项目,请注意VB代码在服务器上运行,不是客户端 - 所以浏览器将在服务器上打开。它可能看起来在开发中工作,因为这两台机器是同一台机器,但是当它们在KM上可能有数千台时,它肯定会在生产中失败!
That code in itself won't open anything - it just returns a URL as a string to whatever method you are calling it from, and that will use the string to open the URL, probably via the Process.Start method.

I'd start by putting a breakpoint on the Return statement, and running your code in the debugger. When it hits the breakpoint, it will stop, and you can use the Call Stack pane to trace back through your code to see what it is doing with the string. Almost certainly, you are calling the containing method in a loop somewhere.

Sorry, but we can't do any of that for you - we have no access to your machine or your source code!


BTW: If this is a web related project, be aware that VB code runs on the server, not the client - so the browser will open on the server. It may appear to work in dev because the two are the same machine, but it most definitely will fail in production when they are potentially thousands on KM apart!