我写了自己的第一个才c#程序。功能是从指定网站中抓取信息保存在本地文本文档中.把本来是Form1.cs的编译成Form1.exe。运行后出现了两个问题
1,我运行Form1.exe的时候会的当前界面背后出现一个讨厌的dos界面。
如果我是在c盘根目录下面运行Form1.exe,dos界面的标题栏就写成是C:\Form1.exe.这个窗口怎么能不出来2.程序一运行我就不能控制拖动界面了(好象是程序死了一样,但是其实还在运行),大概持续要运行一分钟,只能等抓取信息完成了后才能得到控制权。
程序获取的数据流可能有点大,但是这个问题有如何解决了。
1,我运行Form1.exe的时候会的当前界面背后出现一个讨厌的dos界面。
如果我是在c盘根目录下面运行Form1.exe,dos界面的标题栏就写成是C:\Form1.exe.这个窗口怎么能不出来2.程序一运行我就不能控制拖动界面了(好象是程序死了一样,但是其实还在运行),大概持续要运行一分钟,只能等抓取信息完成了后才能得到控制权。
程序获取的数据流可能有点大,但是这个问题有如何解决了。
解决方案 »
- 窗体上有多个文本框控件,怎么用代码判断焦点在哪个上面?
- DataGridView表关联怎么弄
- datagridview 主表和明细表的显示的问题?
- 再问一个关于dataGridView的基础操作。
- ASP。NET用短信猫做群发短信的问题!高手进来!!!!急~~~~~~~~~
- 如何实现Tree的动态加载??
- 关于C#.NET的两个问题。
- .net中为什么一个类实现了两个接口后反射就会出错?
- 根据摄像机的焦距和放大倍数如何求物距
- c# 调用Matlab组件检索 COM 类工厂中 CLSID 为 {56316DA6-9A52-4025-A23A-D5DDC98B2968} 的组件时失败,原
- Winforms中TextBox只能输入数字的问题,不是你想像的简单,高手请进!!!
- 求一sql语句
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null; public Form1()
{
InitializeComponent(); } protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(192, 152);
this.button1.Name = "button1";
this.button1.TabIndex = 0;
this.button1.Text = "搜索";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(272, 269);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false); }
#endregion /// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
} private void button1_Click(object sender, System.EventArgs e)
{ //我写的全部只在这个Click事件中
string url="一个网站的网址";
StreamWriter sw = new StreamWriter("E:\\1.txt");
string content=getbody(url); //这里是我写的一个方法,调用指定网站源码 …………………………………………//中间省略对content的编辑处理
sw.Write(str1);
sw.Close();
}
}