CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Help with a program

Threaded View

  1. #1
    Join Date
    Jan 2010

    Question Help with a program

    I'm trying to make this program that will search google using key words provided from a txt file in order to learn how to make various things interact. However, I'm encountering one problem: if I remove the messagebox that says the txt file's values, the program does not work. But while the messagebox is there, it goes through each line in the txt file as it is suppose to. What do I do to get rid of the messagebox but still have the program work correctly?

    This is the code:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.IO;
    using System.Threading;
    namespace WindowsFormsApplication1
        public partial class Form1 : Form
            bool entered = false;  
            public Form1()
            private void button1_Click(object sender, EventArgs e)
            private void timer1_Tick(object sender, EventArgs e)
                 FileStream fileStream = null;
                   StreamReader streamReader = null;
                       fileStream = new FileStream(@"c:\Users\comp\Desktop\test.txt", FileMode.Open);
                       streamReader = new StreamReader(fileStream);
                       while (true)
                           string line = streamReader.ReadLine();
                        webBrowser1.Document.GetElementById("q").SetAttribute("value", line);
                           if (string.IsNullOrEmpty(line))
                           timer1.Enabled = false;
                       if (streamReader != null)
                       if (fileStream != null)
            private void button2_Click(object sender, EventArgs e)
                timer1.Enabled = false;
            private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
                if (entered == false)
                    timer1.Enabled = true;
                    entered = true;
    (it's in visual studio 2008)
    Last edited by thisismyusername2010; January 17th, 2010 at 07:43 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)