|
-
May 31st, 2012, 07:07 AM
#1
ArrayList adding item
Hi everyone,
I'm new to c#, learning and coding.
That's the my problem;
Code:
namespace Google
{
public partial class Form1 : Form
{
private string url;
private string geturl_2;
private string geturl_els;
private int numbers;
public Form1()
{
InitializeComponent();
CenterToScreen();
}
(............)
private void search_Click(object sender, EventArgs e)
{
if (numbers <= 10)
{
(........)
url = "https://www.google.com.tr/search?q=" + searchtext;
(........)
Thread thread1 = new Thread(new ThreadStart(googlesearch));
thread1.Start();
}
}
(..................)
private void googlesearch()
{
ArrayList urlpool0 = null;
HtmlAgilityPack.HtmlWeb web = new HtmlAgilityPack.HtmlWeb();
HtmlAgilityPack.HtmlDocument doc = web.Load(@url);
HtmlAgilityPack.HtmlNodeCollection rowNodes = doc.DocumentNode.SelectNodes("//cite");
foreach (HtmlAgilityPack.HtmlNode node in rowNodes)
{
string url_1 = node.InnerText;
urlpool0 = new ArrayList();
urlpool0.Add(url_1); // <- This is the my problem.I want to add the elements to array but only one element adding
//textBox4.AppendText(url_1 + "\r\n"); // <- No problem on debuging code, 10 url adding to listview
textBox4.AppendText(urlpool0.Count + "\r\n"); //<-Debuging. Actually should be added to the textbox (status textbox and multiline) like this "1,2,3.. " but adding text to textbox "1,1,1,1,1,1,1...."
}
Fin(urlpool0);
}
private void fin(ArrayList arraytest)
{
foreach (string geturladdr in arraytest)
{
(...........)
}
}
}
Regards,
Thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|