请教 ACCESS VBA中acCheckBox,在C# DAO中哪里找到?

Dx_Happy 2017-11-17 09:47:27
在网上找到一段ACCESS VBA代码,可以将创建的YES/NO 字段显示为复选框,但是里面的acCheckBox我在C# DAO中找不到对应的引用方法,请问下面代码示例中Set prp = fld.CreateProperty("DisplayControl", dbInteger, acCheckBox)这句话应该怎么写?
我现在是这么写的:Property pt = myField.CreateProperty("DisplayControl", DAO.DataTypeEnum.dbInteger, ??);第三个参数不知道怎么赋值
VBA示例如下:
Sub AddDisplayControl()
'Requires reference to Microsoft DAO 3.6 Object Library
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Dim db As Database
Dim strSQL As String

Set db = CurrentDb

'Create a table ...
strSQL = "Create Table tblLTD (TheYesNoCheck YesNo, TheYesNoCombo YesNo)"
db.Execute strSQL

'It is now in the table collection, so ...
Set tdf = db.TableDefs("tblLTD")

'Change the way the YesNo fields display.
'A Checkbox
Set fld = tdf.Fields("TheYesNoCheck")
Set prp = fld.CreateProperty("DisplayControl", dbInteger, acCheckBox)
fld.Properties.Append prp

'A combobox
Set fld = tdf.Fields("TheYesNoCombo")
Set prp = fld.CreateProperty("DisplayControl", dbInteger, acComboBox)
fld.Properties.Append prp
'We will need a format
Set prp = fld.CreateProperty("Format", dbText, "Yes/No")
fld.Properties.Append prp

End Sub
...全文
101 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

110,539

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧