使用组合框的不寻常的数据绑定行为 [英] Unusual databound behaviour with combo boxes

查看:51
本文介绍了使用组合框的不寻常的数据绑定行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据绑定组合(数据绑定到System.Data.DataTable),但有些

相当不可预测的行为 - 即使我在源代码中有8行

表,只有前6个出现在物品集合中。


我现在一直在摸不着头脑,但是不能揣测

这可能应该归咎于这种奇怪。


有没有人见过这种行为,或者可以想到任何可能的原因?

I''ve got a databound combo (databound to a System.Data.DataTable), but some
rather unpredicatable behaviour -- even though I have 8 rows in the source
table, only the first 6 are showing up in the items collection.

I''ve been scratching my head over this for a while now, but can''t fathom
what could be to blame for this oddity.

Has anyone seen this behaviour before, or can think of any possible causes?

推荐答案

Rowland,

对他来说是不可预知的行为,这对我来说是新的。


你可以在设置数据源时显示一些代码或先检查

datastable with


messagebox.show(datatable.rows.count.tostring)

Cor


" Rowland Shaw < sp ******** @ anotherpointless.org>
Rowland,

Although probably everyone who has used a bounded combobox has had at least
for him unpredictable behaviour, is this one new for me.

Can you show some code or check first when you set the datasource the
datastable with

messagebox.show(datatable.rows.count.tostring)

Cor

"Rowland Shaw" <sp********@anotherpointless.org>
我有一个数据绑定组合(数据绑定到System.Data.DataTable),但是相当不可预测的行为 - 即使我在源表中有8行,只有前6个出现在items集合中。

我''我现在已经摸不着头脑了一段时间,但是不能理解这可能应该归咎于这种奇怪的事情。

有没有人见过这种行为,或者可以想到任何可能的原因?
I''ve got a databound combo (databound to a System.Data.DataTable), but
some
rather unpredicatable behaviour -- even though I have 8 rows in the source
table, only the first 6 are showing up in the items collection.

I''ve been scratching my head over this for a while now, but can''t fathom
what could be to blame for this oddity.

Has anyone seen this behaviour before, or can think of any possible
causes?



最简单的代码:


ds = m_Department.LoadList ()


''填充下拉菜单

Cmb_Department.DataSource = ds.Tables(" Departments")

Cmb_Department。 DisplayMember =" Department"

Cmb_Department.ValueMember =" DepartmentID"


现在,毕竟在调试器中停止了这个,

Cmb_Department.Items集合与ds.Tables(Departments)不同。行

集合。


你可能会理解为什么我现在已经摸不着头脑了。

" Cor Ligthert"写道:
The simplest of simple code:

ds = m_Department.LoadList()

''Populate the dropdown
Cmb_Department.DataSource = ds.Tables("Departments")
Cmb_Department.DisplayMember = "Department"
Cmb_Department.ValueMember = "DepartmentID"

Now, when stopped in the debugger immeadiatly after all this,
Cmb_Department.Items collection differs to the ds.Tables("Departments").Rows
collection.

You can probably understand why I''ve been scratching my head a lot now :)
"Cor Ligthert" wrote:
Rowland,

虽然可能每个使用有限组合框的人都至少对他有不可预测的行为,这是一个新的对我来说。

当你设置数据源
时,你能显示一些代码或检查

messagebox.show(datatable.rows.count.tostring )

罗兰萧 < sp ******** @ anotherpointless.org>
Rowland,

Although probably everyone who has used a bounded combobox has had at least
for him unpredictable behaviour, is this one new for me.

Can you show some code or check first when you set the datasource the
datastable with

messagebox.show(datatable.rows.count.tostring)

Cor

"Rowland Shaw" <sp********@anotherpointless.org>
我有一个数据绑定组合(数据绑定到System.Data.DataTable),但是相当不可预测的行为 - 即使我在源表中有8行,只有前6个出现在items集合中。

我''我现在已经摸不着头脑了一段时间,但是不能理解这可能应该归咎于这种奇怪的事情。

有没有人见过这种行为,或者可以想到任何可能的原因?
I''ve got a databound combo (databound to a System.Data.DataTable), but
some
rather unpredicatable behaviour -- even though I have 8 rows in the source
table, only the first 6 are showing up in the items collection.

I''ve been scratching my head over this for a while now, but can''t fathom
what could be to blame for this oddity.

Has anyone seen this behaviour before, or can think of any possible
causes?




罗兰


什么这会给出什么?
Rowland

And what does this give?
''填充下拉列表
Cmb_Department.DataSource = ds.Tables(" Departments")
messagebox.show(ds.tables( " Departments")。rows.coun t.tostring)Cmb_Department.DisplayMember =" Department"
''Populate the dropdown
Cmb_Department.DataSource = ds.Tables("Departments") messagebox.show(ds.tables("Departments").rows.coun t.tostring) Cmb_Department.DisplayMember = "Department"




Cor



Cor


这篇关于使用组合框的不寻常的数据绑定行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆