|
首页>编程技术>编程杂谈> |
用C#查看本地驱动器信息,老是报错!有心人帮看看 |
|
Visited times , Welcome to Data Mining Forum & Data Mining Expert & Data Mining Tools |
|
|
用C#查看本地驱动器信息,老是报错!有心人帮看看如题!源代码如下:
using System;
using System.Web.UI.WebControls;
using System.IO;
namespace FileManage
{
public class Main : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Table T1;
public Main()
{
Page.Init += new EventHandler(Page_Init);
}
protected void Page_Load(object sender, EventArgs e)
{
string[] Drv = Directory.GetLogicalDrivers();
int DrvCnt = Drv.Length;
for(int i=0;i<DrvCnt;i++)
{
TableRow Row=new TableRow();
if(i%2==1)
Row.BackColor=System.Drawing.Color.LightBlue;
TableCell Cel1=new TableCell();
Cel1.HorizontalAlign=HorizontalAlign.Center;
Cel1.Text="<IMG SRC=Images\Drv.ICO border=0 width=20pt height=20pt>";
TableCell Cel2=new TableCell();
Cel2.Text=" 驱动器:<a href=SoeDir.aspx?Dir="+Drv[i]+">"+Drv[i]+"</a>";
Row.Cells.Add(Cel1);
Row.Cells.Add(Cel2);
T1.Rows.Add(Row);
}
}
private void Page_Init(object sender, EventArgs e)
{
InitializeComponent();
}
private void InitializeComponent()
{
this.Load +=new EventHandler(this.Page_Load);
}
}
}
出错信息:
编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。
编译器错误信息: ASPNET: 请确保此代码文件中定义的类与“inherits”属性匹配,并且该类扩展的基类(例如 Page 或 UserControl)是正确的。
源错误:
行 1: using System;
行 2: using System.Data;
行 3: using System.Configuration;
数据挖掘工具
源文件: c:Documents and SettingsOwnerMy DocumentsVisual Studio 2005WebSitesWebSite4main.aspx.cs 行: 1 不错,很好!,,,,,,
|
|
|
|
|
[数据挖掘专家]
[数据挖掘研究院]
[数据挖掘论坛]
[数据挖掘实验室]
|
上一篇:visual studio可否用语JAVA软件开发?
下一篇:C语言选择题
|
|
|
|