Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Dot Net - webbrowser control and case select

Posted on 2009-05-19
1
370 Views
Last Modified: 2013-11-26
I have the following code as a function (see below) for class  navhandler.

The regular expressions work for login and overview.
But they won't work for buildings and etc...

It seems that anything after overview won't work and every page i click is indentified as an overview (after i logged in).

So, login and overview works.

The rest doesn't... But i can't seem to find any mistakes in my code :s
Imports System.Text.RegularExpressions
 
 
Public Class navhandler
    Dim regexLogin As New Regex("http://www.o game.")
    Dim regexOverview As New Regex("/index.php?page=overview&session=[a-z0-9]+")
    Dim regexResources As New Regex("/index.php?page=resources&session=[a-z0-9]+&pc=1")
    Dim regexResearch As New Regex("/index.php?page=buildings&session=[a-z0-9]+&mode=Forschung")
    Dim regexShipYard As New Regex("/index.php?page=buildings&session=[a-z0-9]+&mode=Flotte")
    Dim regexFleet As New Regex("/index.php?page=flotten1&session=[a-z0-9]+&mode=Flotte")
    Dim regexTechnology As New Regex("/index.php?page=techtree&session=[a-z0-9]+")
    Dim regexGalaxy As New Regex("/index.php?page=galaxy")
    Dim regexMessages As New Regex("/index.php?page=messages&dsp=1&session=[a-z0-9]+")
    Dim regexDefence As New Regex("/index.php?page=buildings&session=[a-z0-9]+&mode=Verteidigung")
    Dim regexStatistics As New Regex("/index.php?page=statistics&session=[a-z0-9]+")
    Dim regexBuildings As New Regex("/index.php?page=b_building&session=[a-z0-9]+")
    Dim regexAlliance As New Regex("/index.php?page=allianzen&session=[a-z0-9]+")
    Dim regexSearch As New Regex("/index.php?page=suche&session=[a-z0-9]+")
    Dim regexFriendslist As New Regex("/index.php?page=buddy&session=[a-z0-9]+")
    Dim regexOptions As New Regex("/index.php?page=options&session=[a-z0-9]+")
 
    Public Function typePage() As String
        '@return: login, overview, fleet, defense, alliance, statistics,messages
        Dim typePageSTR, url As String
        Dim blnFound As Boolean = False
 
        typePageSTR = ""
        Dim wb As CustomBrowser = gameBrowser.TabControl1.SelectedTab.Tag
        'source = wb.DocumentText.ToString
        url = wb.Url.ToString
      
        If (regexLogin.Match(url).ToString <> "") Then
            OgameBrowser.lblgamePage.Text = "Detected: Dutch Login page"
            typePageSTR = "login"
            blnFound = True
        End If
        If (regexOverview.Match(url).ToString <> "") Then
            OgameBrowser.lblgamePage.Text = "Detected: Dutch Overview page"
            typePageSTR = "overview"
 
            blnFound = True
        End If
 
        If (regexBuildings.Match(url).ToString <> "") Then
            OgameBrowser.lblgamePage.Text = "Detected: Dutch Buildings page"
            typePageSTR = "buildings"
            blnFound = True
        End If
        If (regexMessages.Match(url).ToString <> "") Then
            OgameBrowser.lblgamePage.Text = "Detected: Dutch Messages page"
            typePageSTR = "messages"
            blnFound = True
        End If
       
        If blnFound = True Then
            Return typePageSTR
        Else
            Return "Page not yet detected OR it's not an game page"
        End If
 
    End Function
End Class

Open in new window

0
Comment
Question by:NicoJuicy
1 Comment
 
LVL 7

Accepted Solution

by:
NicoJuicy earned 0 total points
ID: 24429523
I have found it.

As this is the first time i use regular exprressions, i have to unescape the dots in my urls and the quoatation marks to.

eg. "http://www\.zdnet\.be"
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand columnThat will then direct you to their download page.From that page s…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

809 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