我有那个方法来检索NTFS的可移动设备信息:
private void getdriverinfo()
{
// get the usb flash driver
foreach (DriveInfo driveInfo in DriveInfo.GetDrives())
{
if (driveInfo.DriveType == DriveType.Removable && driveInfo.DriveFormat.Equals("NTFS"))
{
comboBox1.Items.Add(driveInfo.Name);
}
}
if (comboBox1.Items.Count == 0)
{
MessageBox.Show("No Removable Device Found , please plug in the USB drive and make sure it is in NTFS format and retry", "No Device Found!", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else if (comboBox1.Items.Count == 1)
{
comboBox1.Text = comboBox1.Items[0].ToString();
}
else
{
MessageBox.Show(comboBox1.Items.Count + " Removable Devices were found , please …Run Code Online (Sandbox Code Playgroud) 我有一个循环ping请求的方法,我想当我点击Ctrl+时c,它会打破循环并给我像普通cmd一样的静态,但当我点击Ctrl+时c,我得到
按任意键继续... <<
然后程序关闭.
例如:ping google.com -t <<将以无限循环ping谷歌,但我需要在点击Ctrl+ 时才打破循环c
private void _t(string website)
{
Ping pingSender = new Ping();
string data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
byte[] buffer = Encoding.ASCII.GetBytes(data);
int timeout = 10000;
try
{
PingOptions options = new PingOptions(64, false);
PingReply send0 = pingSender.Send(website, timeout, buffer, options);
Console.WriteLine("\nPinging {0} [{1}] With {2} bytes of data :", website, send0.Address.ToString(), send0.Buffer.Length);
while (1 < 2)
{
PingReply reply = pingSender.Send(website, timeout, buffer, …Run Code Online (Sandbox Code Playgroud) 首先,我搜索了很多,所有主题似乎都是C#:调用或调用JavaScript函数,但我想反过来,我想在C#和JavaScript上创建一个函数,我希望JavaScript函数调用C#函数并检索它的数据,这似乎是一个很好的问题.问题是我不知道网络,我不知道它是如何工作的,但我尝试了一个样本:
创建了一个类:
public interface IFoo
{
string Bar { get; set; }
}
public class Foo : IFoo
{
public string Bar { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
然后
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public IFoo CreateFoo()
{
return new Foo() { Bar = "somevalue" };
}
public string Bar(IFoo foo)
{
return foo.Bar;
}
}
Run Code Online (Sandbox Code Playgroud)
和Javascript代码:
<script type="text/javascript" language="javascript" >
function Callme(){
alert('Js function start . keep pressing OK')
var foo = external.CreateFoo(); …Run Code Online (Sandbox Code Playgroud) 我创建了一个循环文件夹并检索每个图像文件并在表单上绘制一个图片框的函数。这是功能:
private void Create_Controls(string Img_path)
{
PictureBox p = new PictureBox();
p.Size = new Size(138, 100);
p.Location = new Point(6, 6);
p.BackgroundImage = Image.FromFile(Img_path);
p.BackgroundImageLayout = ImageLayout.Stretch;
this.Controls.Add(p);
}
Run Code Online (Sandbox Code Playgroud)
所以我需要做的是:每当我点击表单上的任何图片框时,都会弹出一条带有图像文件路径的消息。
所以我想添加一个自定义事件:
p.Click += delegate { Pop_Up(); };
Run Code Online (Sandbox Code Playgroud)
和
private void Pop_Up()
{
/* POP UP MESSAGE WITH Picturebox image file path*/
}
Run Code Online (Sandbox Code Playgroud) 这是我第一次使用SQL Server,我创建了这些表:
create table Department
(
D_Number int not null,
D_Name varchar(20),
D_MgrSSN int,
D_MgrDate datetime,
primary key(D_Number),
unique(D_Name),
)
create table Empolyee
(
E_SSN int not null,
E_FName varchar(20),
E_LName varchar(20),
E_Sex varchar(6),
E_BDate datetime,
E_Salary decimal(10,2),
E_Address varchar(50),
E_Department varchar(20),
E_SuperSSN int,
primary key(E_SSN),
foreign key(E_Department) references Department(D_Number),
)
Run Code Online (Sandbox Code Playgroud)
当我跑步时,我得到这个错误:
列"Department.D_Number"是不相同的数据类型为外键"FK_引用列"Empolyee.E_Department" Empolyee _E_Depa__0CBAE877".
我想创建一个链接列表,其中包含一些人的姓名,年龄和地址,到目前为止我创建了该代码:
LinkedList<string> details = new LinkedList<string>();
details.AddFirst("Name1");
details.AddLast("Name2");
details.AddLast("Name3");
foreach (var display in details)
{
Console.WriteLine(display);
}
Run Code Online (Sandbox Code Playgroud)
好吧,所以现在它工作正常,但我只输入名称,我如何输入年龄和地址,是否像数组?我只是不了解链接列表,我也试图删除链表的一些节点,但我失败了:
foreach (var item in details)
{
if (item.Contains("Name3"))
{
details.Remove(item);
}
}
Run Code Online (Sandbox Code Playgroud)
但我得到了这个错误:
Unhandled Exception: System.InvalidOperationException: Collection was modified after the enumerator was instantiated.
Run Code Online (Sandbox Code Playgroud)
最后,我如何编辑一个链接列表项,比如将Name2重命名为Name13或其他任何东西,我真的很感激任何帮助,只要给我一个想法,我将继续挖掘.提前致谢 .
我有一个很好的程序想法,它将是一个非常简单的应用程序,将在sql server数据库文件中保存您的用户名和密码,我知道该怎么做,但问题是我不希望客户端安装SQL Server为了在数据库中添加或删除记录,除了我希望我的数据库文件嵌入到应用程序中以便用户有一个.exe文件,我听说有一个名为sqllite的东西,它的功能是不让它用户安装sqlserver以使应用程序正常工作.
早上,我主要是一名C#程序员,我非常擅长C#编程,我想开始开发Android应用程序.
所以我有两种方式:
我是新手,我不知道我应该用java开发什么工具.我想知道我应该使用什么版本的eclipse,以及需要开发的外部工具ID是什么,没有任何问题.
我也更喜欢如果我使用C#开发但我只安装了Mono Develop并且它需要许可证并且它很复杂,所以如果有任何免费的IDE请提出建议.
我没有任何思维学习Java,因为它非常类似于C#和OOP语言.
提前致谢
编辑:有一个eclipse版本称为:Eclipse for Mobile Developers,这是我需要的吗?
c# ×7
.net ×2
android ×1
break ×1
browser ×1
connection ×1
driveinfo ×1
eclipse ×1
ide ×1
javascript ×1
key ×1
linked-list ×1
methods ×1
picturebox ×1
sdk ×1
sql ×1
sql-server ×1
winforms ×1