不包含 的定义,并且找不到可接受类型为 的第一个参数的扩展方法 (是否缺少 using 指令或程序集引用)
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.DirectoryServices;
using System.Runtime.InteropServices;
using System.Net.NetworkInformation;
using System.Management;
using Microsoft.VisualBasic;
namespace 自做的系统
{
public partial class frmMain : Form
{
public frmMain()
{
InitializeComponent();
}
private void frmMain_Load(object sender, EventArgs e)
{
}
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
if (treeView1.SelectedNode.Text == "局域网工作组")
tabControl1.SelectedIndex = 0;
if (treeView1.SelectedNode.Text == "局域网计算机节点")
tabControl1.SelectedIndex = 1;
if (treeView1.SelectedNode.Text == "局域网内发送信息")
tabControl1.SelectedIndex = 2;
if (treeView1.SelectedNode.Text == "局域网磁盘管理")
tabControl1.SelectedIndex = 3;
if (treeView1.SelectedNode.Text == "映射网络驱动器")
tabControl1.SelectedIndex = 4;
if (treeView1.SelectedNode.Text == "Ping操作")
tabControl1.SelectedIndex = 5;
if (treeView1.SelectedNode.Text == "监测当前网络连接状态")
tabControl1.SelectedIndex = 6;
if (treeView1.SelectedNode.Text == "文件复制")
tabControl1.SelectedIndex = 7;
if (treeView1.SelectedNode.Text == "远程控制计算机")
tabControl1.SelectedIndex = 8;
if (treeView1.SelectedNode.Text == "远程服务控制")
tabControl1.SelectedIndex = 9;
}
private void 检测当前网络连接状态ToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void toolStripStatusLabel1_Click(object sender, EventArgs e)
{
toolStripStatusLabel1.Width = 200;
toolStripStatusLabel1.Text = "当前时间:" + DateTime.Now.TimeOfDay.ToString();
}
private void timer1_Tick(object sender, EventArgs e)
{
toolStripStatusLabel1_Click (sender, e);
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void btnGroupList_Click(object sender, EventArgs e)
{
DirectoryEntry MainGroup = new DirectoryEntry("WinNT:");
foreach (DirectoryEntry domain in MainGroup.Children)
{
listBox1.Text = "";
listBox1 .Items .Add (domain.Name);
}
}
private void groupBox1_Enter(object sender, EventArgs e)
{
}
private void listBox3_Click(object sender, EventArgs e)
{
MessageBox.Show("开始检索请稍等...");
listBox2.Items.Clear();
DirectoryEntry MainGroup = new DirectoryEntry("WinNT:");
foreach (DirectoryEntry domain in MainGroup.Children)
{
if (domain.Name == this.listBox3.Text)
{
foreach (DirectoryEntry pc in domain.Children)
{
if (pc.Name != "Schema")
this.listBox2.Items.Add(pc.Name);
}
}
}
MessageBox.Show("检索完成");
}
private void btnList_Click(object sender, EventArgs e)
{
DirectoryEntry MainGroup = new DirectoryEntry("WinNT:");
foreach (DirectoryEntry domain in MainGroup.Children)
{
listBox3.Text = "";
listBox3.Items.Add(domain.Name);
}
}
private void sendInfo(string strIP, string strInfo)
{
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo();
psi.FileName = @"cmd.exe";
psi.Arguments = @"/c net send " + strIP + "" + strInfo + "";
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
System.Diagnostics.Process.Start(psi);
}
private void button2_Click(object sender, EventArgs e)
{
sendInfo(this.textBox6.Text, this.richTextBox1.Text.Replace("\n", ""));
}
private void tabPage3_Click(object sender, EventArgs e)
{
}
private void label3_Click(object sender, EventArgs e)
{
}
private void label5_Click(object sender, EventArgs e)
{
}
[DllImport("kernel32.dll",EntryPoint = "GetDiskFreeSpaceEx")]
public static extern int GetDiskFreeSpaceEx(string lpDirectoryName, out long lpFreeBytesAvailable, out long lpTotalNumberOfBytes,out long lpTotalNumberOfFreeBytes);
private void button1_Click(object sender, EventArgs e)
{
if (this.folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
long fb,ftb,tfb;
string str = this.folderBrowserDialog1.SelectedPath;
this.textBox4.Text = str;
if (GetDiskFreeSpaceEx(str, out fb, out ftb, out tfb) !=0)
{
string strfb = Convert.ToString(fb / 1024 / 1024) + "M";
string strftb = Convert.ToString(ftb / 1024 / 1024) + "M";
string strtfb = Convert.ToString(tfb / 1024 / 1024) + "M";
this.textBox2.Text = strfb;//总空间
this.textBox1.Text = strftb;//可用空间
this.textBox3.Text = strtfb;//总剩余空间
}
else
{
MessageBox.Show("没有信息");
}
}
}
private void tabPage4_Click(object sender, EventArgs e)
{
}
}
}
“自做的系统.frmMain”不包含“folderBrowserDialog1”的定义,并且找不到可接受类型为“自做的系统.frmMain”的第一个参数的扩展方法“folderBrowserDialog1”(是否缺少 using 指令或程序集引用?)
我想问一下这个怎么解决啊,求大神请教,具体一点的,谢谢啦。