Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Dot Net - webbrowser control and case select

Posted on 2009-05-19
1
Medium Priority
?
376 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
[X]
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
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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)…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

604 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