Thursday, November 11, 2010

How to make a button in vb that goes to a website?

I want to make a button in vb that goes to a website in another browser that the user has already installed like i want to make a button that opens the main web browser that they have and go to the websiteHow to make a button in vb that goes to a website?
Private Declare Function ShellExecute Lib ';shell32.dll'; Alias ';ShellExecuteA'; (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long





Private Sub Command1_Click()

ShellExecute 0%26amp;, vbNullString, ';http://google.com';, vbNullString, 0%26amp;, 1

End SubHow to make a button in vb that goes to a website?
Within the button declaration put a client side OnClick method that calls a function. When the button is clicked, it will fire the JavaScript function, and open a new window



Put this in the head section of your page

%26lt;script type = ';text/javascript';%26gt;

function ButtonClick()

{

window.open(';yoururl';,';';,';';);

}

%26lt;/script%26gt;



call the onclick method of the button

%26lt;asp:Button id = ';button'; onclick = ';ButtonClick';...



You can reference this site to see how to completely customize the new window that opens...

http://www.pageresource.com/jscript/jwinopen.htm


No comments:

Post a Comment