找回密码
 立即注册

QQ登录

只需一步,快速开始

hand

注册会员

11

主题

37

帖子

128

积分

注册会员

积分
128

活字格认证

hand
注册会员   /  发表于:2015-12-25 10:46  /   查看:4575  /  回复:9
QQ截图20151225104453.png

如图,怎么把已经获取到的数据显示到下拉列表中去

9 个回复

倒序浏览
frank.zhang
社区贡献组   /  发表于:2015-12-25 17:17:00
沙发
您好,

目前没有能够直接对应的方法。
需要将数据库里面的取出来,可以参考以下代码:
  1.       string[] cbstr;
  2.       cbstr = new String[] {"One", "Two", "Three"};
  3.       string[] strval;
  4.       strval = new String[] {"1", "2", "3"};
  5.       combo.Items = cbstr;
  6.       combo.ItemData = strval;
  7.       combo.EditorValue = FarPoint.Win.Spread.CellType.EditorValue.ItemData;
  8.       fpSpread1.Sheets[0].Cells[0, 0].CellType = combo;
复制代码
回复 使用道具 举报
hand
注册会员   /  发表于:2015-12-28 09:56:00
板凳
非常感谢
这是Spread3.0+VB6.0,数据已经从数据库取出,该怎么显示上去呢?
回复 使用道具 举报
frank.zhang
社区贡献组   /  发表于:2015-12-28 15:02:00
地板
您好,

可以参考以下代码
  1. [Visual Basic]
  2. Dim cbstr As string( )
  3. cbstr = new String() {"Jan", "Feb", "Mar", "Apr", "May", "Jun"}
  4. Dim cmbocell As New FarPoint.Win.Spread.CellType.ComboBoxCellType()
  5. cmbocell.Items = cbstr
  6. cmbocell.AutoSearch = FarPoint.Win.AutoSearch.SingleCharacter
  7. cmbocell.Editable = True
  8. cmbocell.MaxDrop = 4
  9. FpSpread1.ActiveSheet.Cells(0, 0).CellType = cmbocell
复制代码
回复 使用道具 举报
hand
注册会员   /  发表于:2015-12-28 18:06:00
5#
回复 4楼frank.zhang的帖子


QQ截图20151228180446.png
这是需要添加什么引用才能编译吗?
回复 使用道具 举报
frank.zhang
社区贡献组   /  发表于:2015-12-29 12:24:00
6#
您好,

编译错误,要么是少DLL,要么就是语法错误。从图上的信息来看,语法应该没有什么错误。
回复 使用道具 举报
hand
注册会员   /  发表于:2015-12-30 10:08:00
7#
回复 6楼frank.zhang的帖子

这是缺少什么DLL
回复 使用道具 举报
gw0506
超级版主   /  发表于:2015-12-30 14:25:00
8#
你都加了什么dll?你把凡是FarPoint开头的dll全部添加进去。
回复 使用道具 举报
hand
注册会员   /  发表于:2016-1-4 16:15:00
9#
1.png
请问以下功能是否能直接设置Spread属性实现:
当Spread3.0表格中的Combox的Text值被改变,所对应左边的check box自动勾选上
回复 使用道具 举报
frank.zhang
社区贡献组   /  发表于:2016-1-4 17:40:00
10#
您好,

实现的思路是,当Combox值改变时,会触发change事件,在这个事件中设置check box的值。
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部