Tick each checkboxes in the listview

Hi guys,

I need your urgently help. I have extract each strings from mystrings to input them in the listview. Now I want to know how i can tick the checkboxes for each array in the listview when i'm checking for each "enabled" strings in the php source on each line?

Here's the code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
System::Void Form1::timer1_Tick(System::Object^  sender, System::EventArgs^  e)
{
    timer1->Enabled = false;
    timer1::Stop();

    try
    {
        String ^URL1 = "http://www.mysite.com/myscript.php?user=test&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 id='mystrings1'>(.*?)</p>(.*?)<span id=\"mystrings2\">Enabled</td>)";
        MatchCollection ^matches1 = Regex::Matches(str1, pattern1);

        for each (Match ^x1 in matches1)
        {
            array<String^> ^StrArr1 = x1->Value->ToString()->Split();
            Listview1::Items->Add(x1->ToString());
        }
    }
    catch (Exception ^ex)
    {
    }
}



If you do know how to do this, I will be very grateful.

Thanks,
Mark
Every listview item has a Checked property. Set it to true and that's it, I guess. See MSDN Online for detailed explanations and reference.

What I don't get is why you insist in posting C++/CLI questions here. So far you haven't received an answer to your CLI questions except "post @ MSDN forums", which is the best advise for you. Why don't you just follow this advise? There are dozens of CLI programmers there that would help you out much faster.
TS, is this a web based program? If so you should really look into the ASP.Net platform. I am a Computer Science Major so I have been ingrained with C++ but when it comes to web programming I have tried both PHP and ASP.Net and ASP.Net is by far the supreme platform/framework/whatever you want to call it.
You can use listviews to your hearts content and it really just comes down to realizing how many options you are actually given.
Last edited on
thanks for the help guys. Can you please help me how to tick the checkboxes for each listviewitem in the listview when I find each strings from the php source called "enabled" while the strings are on the same line as the strings, e.g the "enabled" strings is on the same line as the "my strings 2 or what ever it is". I'd hope you get this.



here's the current code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
System::Void Form1::timer1_Tick(System::Object^  sender, System::EventArgs^  e)
{
    timer1->Enabled = false;
    timer1::Stop();

    try
    {
        String ^URL1 = "http://www.mysite.com/myscript.php?user=test&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 id='mystrings1'>(.*?)</p>)";
	MatchCollection ^matches1 = Regex::Matches(str1, pattern1);

	for each (Match ^x1 in matches1)
	{
		ListViewItem ^item1 = gcnew ListViewItem("",1);
		item1->SubItems->Add(x1->Value->ToString()->Replace("<p id='mystrings1'>", "")->Replace("</p>", ""));
		listView1::Items->AddRange(gcnew array<ListViewItem^>{item1});
		listView1->CheckBoxes = true;
	}
    }
    catch (Exception ^ex)
    {
    }
}



If you know how to tick the checkboxes for each listviewitem in the listview on the same line as the "enabled" strings, i would be very grateful.

if you aren't sure what i means then take a look on the screenshot and get back to me if you get it.

php page
[url]http://img840.imageshack.us/img840/7051/phppage.jpg[/url]


my listview
[url]http://img819.imageshack.us/img819/133/listview.jpg[/url]



hope you can be able to help me with this.

Thanks,
Mark
do anyone know how i can check the string 'enabled' in my php page for each paragraph while being matching with each listview items?
Topic archived. No new replies allowed.