Hi guys,

I need your help. I am using managed c++/cli to code for my project. I know how to add the listview items by extact the data from the website. Now I just want to know how I can do the autosearch in the textbox to search the actual items in the listview?

I have tried this:

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::Net;
using namespace System::Text::RegularExpressions;
using namespace System::IO;
using namespace System::Text;
using namespace System::Web;
using namespace System::Configuration;
using namespace System::Collections::Generic;
using namespace System::Runtime::InteropServices;

	bool isMatch(ListViewItem ^lvi)
		return lvi->Text->StartsWith(TextBox1->Text);

private: System::Void TextBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {

			Random ^r = gcnew Random();
			List<ListViewItem^> ^items = gcnew List<ListViewItem^>();
			array<ListViewItem^> ^filteredItems = Array::FindAll(items->ToArray(), gcnew System::Predicate<ListViewItem^>(this, &Form2::isMatch));

private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) {

			 MessageBox::Show("timer starts now");
			 timer1->Enabled = false;
			 Form2 ^form7 = gcnew Form2();

				 //Address of URL
				 String ^URL = "http://www.mysite.com/login.php?user=" + form2->ComboBox1->Text + "&pass=" + form2->TextBox1->Text;
				 HttpWebRequest ^request = safe_cast<HttpWebRequest^>(WebRequest::Create(URL));
				 HttpWebResponse ^response = safe_cast<HttpWebResponse^>(request->GetResponse());
				 StreamReader ^reader = gcnew StreamReader(response->GetResponseStream());
				 String ^str = reader->ReadToEnd();

				 String ^pattern1 = "(<p id='myid1'>(.*?)</p>)";
				 MatchCollection ^matches1 = Regex::Matches(str, pattern1);

				Random ^r = gcnew Random();
				List<ListViewItem^> ^items = gcnew List<ListViewItem^>();

				 for each (Match ^x1 in matches1)
		 array<String^> ^StrArr1 = x1->Value->ToString()->Split();
		 items->Add(gcnew ListViewItem(gcnew array<String^> {x1->Value->ToString()->Replace("<p id='myid1'>", "")->Replace("</p>", "")}));
			 catch (Exception ^ex)
				 MessageBox::Show("the site you request is down!");

It doesn't work. None of the listview items have been adding in the listview.

Do you know what the problem is?

Any advice would be much appreicate.