标签: combobox

枚举为整数,反之亦然(使用combobox itemindex)

不知道我在这里做错了什么

//update controls from main form Tshape
 form2.cbxShape.ItemIndex:= ord(Shape1.Shape);
 form2.cbxColor.Selected:= Shape1.Brush.Color;
 form2.cbxStyle.ItemIndex:= Ord(Shape1.Brush.Style);
 if form2.ShowModal = mrOK then
 begin
  //update main form Tshape from controls
   Shape1.Shape:= TShapeType(form2.cbxShape.ItemIndex);
   Shape1.Brush.Color:= form2.cbxColor.Selected;
   Shape1.Brush.Style:= TBrushStyle(form2.cbxStyle.ItemIndex);
 end;
Run Code Online (Sandbox Code Playgroud)

我没有得到正确的形状或画笔样式(颜色工作正常)

列表框项目如下:

Circle
Ellipse
Rectangle
RoundRect
RoundSquare
Square
Run Code Online (Sandbox Code Playgroud)

BDiagonal
Clear
Cross
DiagCross
FDiagonal
Horizontal
Solid
Run Code Online (Sandbox Code Playgroud)

delphi combobox

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

在combobox中提供建议

我希望我的组合框下拉并在用户键入组合框时提供建议.

例如,如果用户键入"R",则应建议以"R"开头的所有项目(例如Roshan,Rohan,Rishan等).

我可以从数据库中获取数据,但问题是如何下载组合框?

c# combobox autosuggest

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

Java Combobox,管理数据库中的2个字段

我想从我的数据库中获取包含2个字段的结果集.

 rs=Con.sqlQueryTable("Select id_prov, name_prov from prov");
Run Code Online (Sandbox Code Playgroud)

然后我想在comboBox中显示名为"name_prov"的字段(作为项目).但我也希望将我的"id_prov"作为ID(PRIMARY KEY)作为此项的值.这用于仅通过使用组合框将(在这种情况下的提供者)名称与其ID相关联.

这是我正在使用的JComboBox事件FocusGained的代码.

try {
        //CBProv is the Combobox
        CBProv.removeAllItems();


        rs=Con.sqlQueryTable("Select id_prov, name_prov from prov");

        while(rs.next())
        {

            CBProvedores.addItem(rs.getString("name_prov"));
            //Here should be the Value related to the item I am creating



        }
    } catch (Exception e) {
        JOptionPane.showMessageDialog(this, "Error" + e  );
    }
Run Code Online (Sandbox Code Playgroud)

无论如何我能做到这一点吗?

java database combobox field

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

如何使用WIN32 API(C/C++)在组合框中捕获"输入密钥"?

当用户在组合框中按Enter键时,我想要捕获事件.怎么抓住你 例如:我在组合框中键入"Nguyen Phong Sac".按Enter键后,会显示一条消息:"Nguyen Phong Sac".谢谢你的帮助,

api winapi combobox enter key

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

将两个组合框绑定到同一数据源,每个组合将具有单独的行为

现在,当我在第一个组合框中选择项目时,第二个模拟选择.我希望能够单独选择每个组合框.谢谢.

 List<W6AdminUIs2.DictionaryObject> taskStatuses = W6AdminUIs2.GlobalFunctions.GetDictionaryItems("TaskStatus");

    // Init the binding source of the statuses.
    BindingSource bsFromStatuses = new BindingSource();
    bsFromStatuses.DataSource = taskStatuses;

    //Bind the "From" combo box to binding source.
    cBoxFrom.DataSource = bsFromStatuses.DataSource;
    cBoxFrom.DisplayMember = "Name";
    cBoxFrom.ValueMember = "Key";

    // Init the binding source of the statuses.
    BindingSource bsToStatuses = new BindingSource();
    bsToStatuses.DataSource = taskStatuses;

    //Bind the "From" combo box to binding source.
    cBoxTo.DataSource = bsToStatuses.DataSource;
    cBoxTo.DisplayMember = "Name";
    cBoxTo.ValueMember = "Key";
Run Code Online (Sandbox Code Playgroud)

c# binding combobox winforms

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

EXCEL VBA:Userform代码,重复代码改进

我是否有更有效的方法来编写此用户表单代码?

Private Sub Userform_Initialize()

'do stuff

    With Item1_DropDown
        .AddItem "Monday"
        .AddItem "Tuesday"
        .AddItem "Wednesday"
    End With

    With Item2_DropDown
        .AddItem "Monday"
        .AddItem "Tuesday"
        .AddItem "Wednesday"
    End With

    With Item3_DropDown
        .AddItem "Monday"
        .AddItem "Tuesday"
        .AddItem "Wednesday"
    End With

'and so on, and so on. (I have about fifty of these 'With/End With' blocks)

End Sub
Run Code Online (Sandbox Code Playgroud)

基本上,我希望能够停止写这么多'With/End With'块.现在,我在四个类似构造的用户表单中有这种类型的代码.它占用了太多的文本空间,似乎是一种浪费.有一个更好的方法吗?

请知道我从未写过课程模块.所以,如果解决方案需要它,我将需要被其中的宝宝所吸引.

谢谢,

埃利亚斯

excel vba combobox class userform

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

C#索引超出了数组的范围[combobox]

下面是我开始调试时导致错误的代码.当我从combobox1或combobox2选择选项时,我收到一条消息:Index超出了数组的范围.我该怎么解决这个问题?

谢谢你的时间阅读.:)

public Form1()
{
    InitializeComponent();
    String[] arr1 = new String[2];

    arr1[0] = "SG";
    arr1[1] = "MY";

    comboBox1.Items.AddRange(arr1);
    comboBox2.Items.AddRange(arr1);        
}

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
    double[,] arr = new double[2, 2];

    for(int i = 0; i <2; i++)
    {            
        arr[0, 0] = 1;
        arr[0, 1] = 1.24;
        arr[1, 0] = 0.80;
        arr[1, 1] = 1;
        label1.Text = 
            arr[comboBox1.SelectedIndex,
                comboBox2.SelectedIndex].ToString();//Index was outside the bounds of the array.         
    }
}

private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{           
    double[,] arr = …
Run Code Online (Sandbox Code Playgroud)

c# arrays combobox

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

"创建组合框"中的"控件没有父级"

在这段代码中:

unit MSEC;

interface

uses
  Winapi.Windows, Vcl.Dialogs, Vcl.ExtCtrls, System.SysUtils, System.Classes, Vcl.Controls, Vcl.StdCtrls;

type
  TMSEC = class(TWinControl)
  private
    FOpr                  :TComboBox;
  public
    constructor Create(AOwner: TComponent); override;
  end;

implementation

const
    DEF_OPERATIONS :array[0..3] of Char = ('+', '-', '*', '/');

constructor TMSEC.Create(AOwner: TComponent);
var i         :Integer;
begin
  inherited;
  FOpr:= TComboBox.Create(Self);
  with FOpr do begin
    Parent:= Self;
    Align:= alLeft;
    Width:= DEF_OPERATIONS_WIDTH;
    Style:= csDropDownList;
    //error in next lines :
    Items.Clear;
    for i := Low(DEF_OPERATIONS) to High(DEF_OPERATIONS) do Items.Add(DEF_OPERATIONS[i]);
    ItemIndex:= 0;  
  end;
end;

end.
Run Code Online (Sandbox Code Playgroud)

当我更改ComboBox项目时,程序会中断消息:
'Control'没有父项.
如何修复此错误或以其他方式初始化ComboBox项?

delphi components combobox

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

你调用的对象是空的.得到这个错误

我正在开发一个ASP .Net C#项目,我是网络编程的初学者.我在运行时得到以下错误:

你调用的对象是空的.

以下是我的代码:

protected void Page_Load(object sender, EventArgs e)
{
    txtUsername.Focus();
    if (cmbThemes.SelectedItem.Text=="Red")
    {
        pnlSignin.Border.BorderColor = Color.Orange;
    }
}
Run Code Online (Sandbox Code Playgroud)

cmbThemes是一个ComboBox.

提前致谢.

.net c# asp.net combobox

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

我如何在一行中做到这一点?

我如何在一个声明中这样做?我尝试通过删除;和添加一个+inbetween而在一个语句中创建它们但它不起作用.sName并且sRealname是字符串.

comboBox1.Items.Add(sName);
comboBox1.Items.Add(sRealname);
Run Code Online (Sandbox Code Playgroud)

编辑:抱歉混乱.我需要comboBox上的文本显示在sName和sRealname的1行中,但是我需要为每个字符串分隔代码,因为如果不是代码中断

c# combobox

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

标签 统计

combobox ×10

c# ×5

delphi ×2

.net ×1

api ×1

arrays ×1

asp.net ×1

autosuggest ×1

binding ×1

class ×1

components ×1

database ×1

enter ×1

excel ×1

field ×1

java ×1

key ×1

userform ×1

vba ×1

winapi ×1

winforms ×1