Solved

Help with accessing URL from button click event

Posted on 2015-01-24
11
136 Views
Last Modified: 2015-01-24
Hi,

How do you activate a URL from a button click event using VB.NET?

Thanks,

Victor
0
Comment
Question by:vcharles
  • 5
  • 5
11 Comments
 
LVL 62

Expert Comment

by:Fernando Soto
Comment Utility
Hi Victor;

Not sure if I can help with this one. What platform Windows Form, Web application? What do you mean by activate a URL?
0
 

Author Comment

by:vcharles
Comment Utility
Hi,

I mean a web application (i.e. http://www.experts-exchange.com)

Victor
0
 
LVL 62

Expert Comment

by:Fernando Soto
Comment Utility
Hi Victor;

Please see this Microsoft documentation on two ways to achieve this client side or server side.

How to: Redirect Users to Another Page
0
 

Author Comment

by:vcharles
Comment Utility
Hi,

Unfortunately it does not work because I'm trying to access a web page from a Windows form, the article is for accessing a web page from a web page.


Thanks,

Victor
0
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 400 total points
Comment Utility
Hi Victor;

This is the reason why I wanted to know what platform you wanted to get access to the Web page in a previous response.

From a Windows application you can download the web page as a string as follows.

Imports System.Net

Dim wc As New WebClient()
Dim Url As String = "http://www.eggheadcafe.com"
Dim result As String = wc.DownloadString(Url)

Open in new window

0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:vcharles
Comment Utility
Hi,

I tried the code below but the web page does not appear.

Imports System.Net

 Private Sub Button17_Click(sender As System.Object, e As System.EventArgs) Handles Button17.Click
        Dim wc As New WebClient()
        Dim Url As String = "http://www.yahoo.com"
        Dim result As String = wc.DownloadString(Url)
    End Sub

V.
0
 
LVL 11

Assisted Solution

by:louisfr
louisfr earned 100 total points
Comment Utility
If you want to open the page in a browser, call Process.Start with the address as parameter:
Process.Start Url

Open in new window

0
 
LVL 62

Expert Comment

by:Fernando Soto
Comment Utility
Hi Victor;

The code I posted will bring the web page in HTML format into a string variable, is that not what you wanted? If you want to display that in a Windows form you can use a web browser control.
0
 
LVL 62

Expert Comment

by:Fernando Soto
Comment Utility
0
 

Author Comment

by:vcharles
Comment Utility
Hi Fernando,

Alp needed to view the page, last part of the code from the other post worked.

Thanks,

V.
0
 

Author Closing Comment

by:vcharles
Comment Utility
Thank You.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now