CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2006
    Posts
    326

    The type or namespace name 'Form1' could not be found

    It's very simple example. but...
    Code:
    using System;
    using System.Collections.Generic;
    using System.Windows.Forms;
    
        static class Program
        {
            /// <summary>
            /// The main entry point for the application.
            /// </summary>
            [STAThread]
            static void Main()
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Form1());//here!!!!!!
                TestURL T = new TestURL();
                T.download();
            }
        }
    Code:
    using System;
    class TestURL
    {
            
        public void download()
        {
            CSDownloadURL web = new CSDownloadURL();
            string strOut;
            web.setURL1("http://www.google.com");
            web.DownloadURL(out strOut);
            Console.WriteLine(strOut);
        }
    }
    Code:
    using System;
    using System.Text;
    using System.IO;
    using System.Net;
    
    public class CSDownloadURL
    {
        private string m_strURL;
        public void setURL1(string strURL)
        {
            m_strURL = strURL;
        }
    
        public void DownloadURL(out string strContents)
        {
            WebRequest req = WebRequest.Create(m_strURL);
            WebResponse res = req.GetResponse();
            int iTotalBuff = 0;
            Byte[] Buffer = new Byte[128];
            Stream stream = res.GetResponseStream();
            iTotalBuff = stream.Read(Buffer, 0, 128);
            StringBuilder strRes = new StringBuilder("");
            while (iTotalBuff != 0)
            {
                strRes.Append(Encoding.ASCII.GetString(Buffer, 0, iTotalBuff));
                iTotalBuff = stream.Read(Buffer, 0, 128);
            }
            strContents = strRes.ToString();
        }
    }
    Thanks for your help

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto
    Posts
    805

    Re: The type or namespace name 'Form1' could not be found

    whats eactly the question here ?
    and where exactly does this break ? error messages? stack trace? anything?
    mcm
    rate my posts!
    mcm

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured