I need your help with the loop. When I load a form to set up the timer to one second, it will get access to my site via httpwebrequest. It will look for the html tags called "mystrings1" and it will look for the matches pattern in the same line as the mystrings1 tags to see if the tags has "<span mystrings2>"Enabled"", then it will display the messagebox when each matches are found.
System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e)
timer1->Enabled = false;
String ^URL1 = "http://www.mysite.com/ChannelsList.php?user=tester&pass=test";
HttpWebRequest ^request1 = safe_cast<HttpWebRequest^>(WebRequest::Create(URL1));
HttpWebResponse ^response1 = safe_cast<HttpWebResponse^>(request1->GetResponse());
StreamReader ^reader1 = gcnew StreamReader(response1->GetResponseStream());
String ^str1 = reader1->ReadToEnd();
String ^pattern1 = "(<p\\sid='mystrings1'>(?<mystrings1>[^<>]+)</p>.*<span id=\"mystrings2\">Enabled)";
Regex^ r = gcnew Regex (pattern1, RegexOptions::IgnoreCase);
MatchCollection ^matches1 = r->Matches(str1, pattern1);
for each (Match ^x1 in matches1)
array<String^> ^StrArr1 = x1->Value->ToString()->Split();
catch (Exception ^ex)
What my code are doing is when they get access to my site, they will look for the tags called "mystrings1" and it will look for the matches pattern in the same line as the mystrings1 tags to see if the tags has "<span mystrings2>"Enabled"", then it will only display the messagebox once at a time when more than one matches are found.
I have already set the loops using with For Each x1 As Match In matches1 statement.
Do you know why the loops isn't working and are there a way to fix the problem?