Пример #1
0
 private void btnRetreive_Click(object sender, EventArgs e)
 {
     //Retrieve newsgroup entries
     btnRetreive.Enabled = false;
     try
     {
         NntpClient nntp = new NntpClient();
         nntp.Connect(txtServer.Text);
         NewsGroup group = nntp.SelectGroup(txtnews.Text);
         //Display the listView1 of entries received
         for (int i = 0; i < 10; i++)
         {
             try
             {
                 listView1.Items.Add(new ListViewItem(group.RetrieveHeaderObject().Subject));
                 group.Next();
             }
             catch
             {
             }
         }
         nntp.Disconnect();
     }
     finally
     {
         btnRetreive.Enabled = true;
     }
 }
Пример #2
0
        private void btnRetreive_Click(object sender, EventArgs e)
        {
            NntpClient nntp = new NntpClient();

            nntp.Connect(txtServer.Text);
            NewsGroup group = nntp.SelectGroup(txtnews.Text);

            for (int i = 0; i < 10; i++)
            {
                try
                {
                    listView1.Items.Add(new ListViewItem(group.RetrieveHeaderObject().Subject));
                    group.Next();
                }
                catch
                {
                }
            }
            nntp.Disconnect();
        }