Using the PageRank DLL in your applications (VB.NET)
- April 30th, 2009
- Write comment
To complete this walkthrough you’ll need to download the PageRank DLL. This is included in the PageRank Checker download on the downloads page.
Extract the ZIP file. The DLL file is in the path: GetPageRank.zip\PageRank\bin\Debug
Make a note of the path as you’ll need it later.
Start by opening up Visual Studio (or Developer Express etc) and creating a new project of type: Windows Application.
Then add the following controls to the main form:
Label: Text = “Website URL”
Label: Text = “Google PageRank:”
Label: Name = “lblResult” and Text = “-”
Textbox: Name = “txtURL”
Button: Name = “btnGo” and Text = “GO”
The next step is to add a reference to the DLL into your project. Generally you would right-click on the Project in the Solution Explorer and select “Add Reference”.
When the dialog box eventually opens up, select the “Browse” tab and find the DLL file which should be called “PageRank.dll”, then click OK.
OK, double-click on the button you’ve labelled “GO” which will create an event handler for the button’s OnClick event.
I’ve provided the code in C# and VB.Net
Directions for C#
Add the following line to the top of the file:
using PageRank;
Then inside the event handler:
TGooglePR prCheck = new TGooglePR(); lblResult.Text = prCheck.ReturnPageRank(txtURL.Text);
and you’re done.
Directions for VB.Net
Add the following line to the top of the file:
Imports PageRank
Then inside the event handler:
Dim prCheck As New TGooglePR() lblResult.Text = prCheck.ReturnPageRank(txtURL.Text)
and you’re done.
Just run the project and enter a full URL in the textbox before clicking on “GO”. The Google PageRank will be shown in the label within a second or so.
Enjoy.
Plus I’ve done a video walthrough in C# and posted it on YouTube: http://www.youtube.com/watch?v=F9MgNVmJnro
