小编Iak*_*ovl的帖子

如何防止手动输入到C#中的ComboBox

我在C#中有一个使用a的表单ComboBox.如何防止用户ComboBox在C#中手动输入文本?

this.comboBoxType.Font = new System.Drawing.Font("Arial", 15.75F);
this.comboBoxType.FormattingEnabled = true;
this.comboBoxType.Items.AddRange(new object[] {
            "a",
            "b",
            "c"});
this.comboBoxType.Location = new System.Drawing.Point(742, 364);
this.comboBoxType.Name = "comboBoxType";
this.comboBoxType.Size = new System.Drawing.Size(89, 32);
this.comboBoxType.TabIndex = 57;   
Run Code Online (Sandbox Code Playgroud)

我希望ABC成为唯一的选择.

c# string combobox

49
推荐指数
3
解决办法
8万
查看次数

如何确定打印机是否存在?

可能重复:
如何使用C#检查打印机是否已安装并准备就绪?

当我遇到一般错误的异常时,我使用PDFCreator从C#程序中生成pdf文件,我想知道如何检查打印机本身是否存在于系统中。

像文件存在检查。

有这样的选择吗?

c# printing

1
推荐指数
1
解决办法
4481
查看次数

在SQL Server数据库中更新希伯来语文本以"???"结束

我正在编写一个C#程序来将数据输入SQL Server 2008数据库.

我使用以下函数将信息输入数据库

public bool AddSupplier(string name, string contactPerson, string telephone, string fax, string type, string payment, string comments)
{
        _cmd.CommandText =
            "INSERT INTO suppliers (name,contactPerson,telephone,fax,type,payment,active,comments) VALUES (@name,@contactPerson,@telephone,@fax,@type,@payment,@active,@comments);";
        _cmd.Parameters.Clear();
        _cmd.Parameters.AddWithValue("@name", name);
        _cmd.Parameters.AddWithValue("@contactPerson", contactPerson);
        _cmd.Parameters.AddWithValue("@telephone", telephone);
        _cmd.Parameters.AddWithValue("@fax", fax);
        _cmd.Parameters.AddWithValue("@type", type);
        _cmd.Parameters.AddWithValue("@payment", payment);
        _cmd.Parameters.AddWithValue("@active", 1);
        _cmd.Parameters.AddWithValue("@comments", comments);
        _con.Open(); 
        _cmd.ExecuteNonQuery(); 
        _con.Close();
        return true; 
    }
Run Code Online (Sandbox Code Playgroud)

这很好用,我可以用希伯来语添加信息,它会显示在数据库中.

当我尝试使用此功能编辑它时

public bool EditSupplier(int supplierId,string name, string contactPerson, string telephone, string fax, string type, string payment, string comments)
{
        _cmd.CommandText = "UPDATE suppliers SET name='" + name …
Run Code Online (Sandbox Code Playgroud)

c# sql database input hebrew

0
推荐指数
1
解决办法
561
查看次数

标签 统计

c# ×3

combobox ×1

database ×1

hebrew ×1

input ×1

printing ×1

sql ×1

string ×1