Question how to tick each checkbox in the listview?

mark103

Member
Joined
Apr 13, 2008
Messages
11
Programming Experience
3-5
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:

VB.NET:
Private timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs)
	timer1.Enabled = False
	timer1.Stop()

	Try
		Dim URL1 As String = "http://www.mysite.com/myscript.php?user=test&pass=test"
		Dim request1 As HttpWebRequest = CType(WebRequest.Create(URL1), HttpWebRequest)
		Dim response1 As HttpWebResponse = CType(request1.GetResponse(), HttpWebResponse)
		Dim reader1 As New StreamReader(response1.GetResponseStream())
		Dim str1 As String = reader1.ReadToEnd()
		Dim pattern1 As String = "(<p id='mystrings1'>(.*?)</p>(.*?)<span id=""mystrings2"">Enabled</td>)"
		Dim matches1 As MatchCollection = Regex.Matches(str1, pattern1)

		For Each x1 As Match In matches1
			Dim StrArr1() As String = x1.Value.ToString().Split()
			Listview1.Items.Add(x1.ToString())
		Next x1
	Catch ex As Exception
	End Try
End Sub

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

Thanks,
Mark
 
thanks for the help john. Can you please help me how to tick the checkboxes for each listviewitem in the listview when I check for each strings 'enabled' from the php source?

here's the current code:

VB.NET:
Public Sub timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs)
        timer1.Enabled = False
        timer1.Stop()

        Try
            Dim URL1 As String = "http://www.mysite.com/myscript.php?user=test&pass=test"
            Dim request1 As HttpWebRequest = CType(WebRequest.Create(URL1), HttpWebRequest)
            Dim response1 As HttpWebResponse = CType(request1.GetResponse(), HttpWebResponse)
            Dim reader1 As New StreamReader(response1.GetResponseStream())
            Dim str1 As String = reader1.ReadToEnd()
            Dim pattern1 As String = "(<p id='mystrings1'>(.*?)</p>)"
            Dim matches1 As MatchCollection = Regex.Matches(str1, pattern1)

            For Each x1 As Match In matches1
                Dim item1 As New ListViewItem("",1)
                item1.SubItems.Add(x1.Value.ToString().Replace("<p id='mystrings1'>", "").Replace("</p>", ""))
                listView1.Items.AddRange(New ListViewItem(){item1})
                listView1.CheckBoxes = True
            Next x1
        Catch ex As Exception
        End Try
    End Sub


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
http://img840.imageshack.us/img840/7051/phppage.jpg


my listview
http://img819.imageshack.us/img819/133/listview.jpg



hope you can be able to help me with this.

Thanks,
Mark
 
Back
Top