?
Solved

Dot Net - webbrowser control and case select

Posted on 2009-05-19
1
Medium Priority
?
375 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
Suggested Courses

771 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