绑定 ado的属性设置对了吗,比如记录源之类的? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 ado的属性设置没有错,因为在datagrid中数据已经显示出来了 Dim r1 As ADODB.RecordsetDim msgtext As StringSet r1 = ExecuteSQL(textsql, msgtext)List1.Clear While (r1.EOF = False) List1.AddItem (Trim(r1!姓名)) r1.MoveNext Wend r1.Close listbox的绑定好像是有问题.能绑定,但不能显示,却可以更新数据..不过我能找到相关支持只有这个Knowledge Base Articles PRB: Bound ListBox Doesn't Show List Item When MultiSelect = 2--------------------------------------------------------------The information in this article applies to:Microsoft Visual Basic Learning Edition for Windows, version 6.0 Microsoft Visual Basic Professional Edition for Windows, version 6.0 Microsoft Visual Basic Enterprise Edition for Windows, version 6.0 Microsoft Visual Basic Standard Edition for Windows, version 4.0 Microsoft Visual Basic Professional Edition for Windows, version 4.0 Microsoft Visual Basic Enterprise Edition for Windows, version 4.0 Microsoft Visual Basic Standard Edition for Windows, version 4.0 Microsoft Visual Basic Professional Edition for Windows, version 4.0 Microsoft Visual Basic Enterprise Edition for Windows, version 4.0-------------------------------------------------------------------SYMPTOMSIf you set the MultiSelect property of a bound Standard ListBox control at design time to 2-Extended, and then run the application, you can MultiSelect with CTRL+Click but the control is not bound to the Data control at this time. When you go back into design mode, the MultiSelect property is reset to 0-None, then when you run again, you get the correct behavior. CAUSEThis is a behavior of Visual Basic. It is not practical to select multiple items from a listbox that is bound to only a single column of a data control. If you set the MultiSelect property of the control to 2-Extended, Visual Basic should reset it back to 0-None before going into run mode, not after it returns from the first run. This way it will not appear that you can almost get MultiSelect to work with a bound listbox. RESOLUTIONDo not set the MultiSelect Property of a bound standard ListBox control to 2-Extended as it will cause this misleading behavior. MORE INFORMATIONSteps to Reproduce Problem in Visual Basic Version 4.0Start a new project in Visual Basic. Form1 is created by default.Add a Data control to Form1.Connect Data1 on Form1 to a table in a database as follows: Select the Data control and press the F4 key to display the Properties window. Set the DatabaseName property to BIBLIO.MDB, and set the RecordSource property to the source table name Publishers.Add a Standard ListBox control to Form1. Select the ListBox control and press the F4 key to display the Properties window. Set the DataSource property to Data1, the DataField property to State, and the MultiSelect property to 2-Extended.Add the following to the Form Load event code: Private Sub Form_Load() List1.AddItem "CA" List1.AddItem "WA" List1.AddItem "PA" List1.AddItem "MA" List1.AddItem "IL" List1.AddItem "FL" End Sub Start the program, or press the F5 key. Click next and previous on the data control and notice how the selection on the listbox does not change even though it is bound to the Data control. You can MultiSelect with CTRL+Click. When you go back into design mode the MultiSelect property is reset to 0-None, then when you run again, you get the correct behavior.Additional query words: kbVBp400 kbVBp600 kbdse kbDSupport kbVBp kbControl Keywords : kbGrpDSVBDB Issue type : kbprb Technology : kbVBSearch kbAudDeveloper kbZNotKeyword6 kbZNotKeyword2 kbVB600Search kbVBA600 kbVB600 kbVB400Search kbVB400 Last Reviewed: January 11, 2001---------------------------------------------------------------Send feedback to Microsoft© 2002 Microsoft Corporation. All rights reserved. 一定要先设置了listbox的值.才能与数据库绑定.太奇怪了. 喔,原来这样,我还以为是怎么回事,那只好用datalist了 关于行级锁定的问题 十六进制转换为十进制的涵数是什么? .scc文件是做什么的? 请教:手工点击“文件”-“打开”-选文件类型,文件名-“确定”,要是用webbrowser控件怎么实现这个过程? 高分请教:用datareaport设计报表时如何将网格线加粗? 请问怎么用打印机打印条形码呢? 急急急,请vb高手帮忙解决如何从文本文档中读取制定字符串的问题! vb關閉當前程序,用api的Sendmassage怎麼用? 谁要下载 Delphi 6? 内详! 请教VB高手:如何打印一份合同? 水晶报表问题,怎样既可以预览,又可以打印?急,帮忙 急问一个数据库操作问题,分会继续加,在线等待!!!!!!
Dim msgtext As String
Set r1 = ExecuteSQL(textsql, msgtext)
List1.Clear
While (r1.EOF = False)
List1.AddItem (Trim(r1!姓名))
r1.MoveNext
Wend
r1.Close
不过我能找到相关支持只有这个
Knowledge Base Articles
PRB: Bound ListBox Doesn't Show List Item When MultiSelect = 2
--------------------------------------------------------------
The information in this article applies to:
Microsoft Visual Basic Learning Edition for Windows, version 6.0
Microsoft Visual Basic Professional Edition for Windows, version 6.0
Microsoft Visual Basic Enterprise Edition for Windows, version 6.0
Microsoft Visual Basic Standard Edition for Windows, version 4.0
Microsoft Visual Basic Professional Edition for Windows, version 4.0
Microsoft Visual Basic Enterprise Edition for Windows, version 4.0
Microsoft Visual Basic Standard Edition for Windows, version 4.0
Microsoft Visual Basic Professional Edition for Windows, version 4.0
Microsoft Visual Basic Enterprise Edition for Windows, version 4.0
-------------------------------------------------------------------
SYMPTOMS
If you set the MultiSelect property of a bound Standard ListBox control at design time to 2-Extended, and then run the application, you can MultiSelect with CTRL+Click but the control is not bound to the Data control at this time. When you go back into design mode, the MultiSelect property is reset to 0-None, then when you run again, you get the correct behavior.
CAUSE
This is a behavior of Visual Basic. It is not practical to select multiple items from a listbox that is bound to only a single column of a data control. If you set the MultiSelect property of the control to 2-Extended, Visual Basic should reset it back to 0-None before going into run mode, not after it returns from the first run. This way it will not appear that you can almost get MultiSelect to work with a bound listbox. RESOLUTION
Do not set the MultiSelect Property of a bound standard ListBox control to 2-Extended as it will cause this misleading behavior. MORE INFORMATION
Steps to Reproduce Problem in Visual Basic Version 4.0
Start a new project in Visual Basic. Form1 is created by default.
Add a Data control to Form1.
Connect Data1 on Form1 to a table in a database as follows: Select the Data control and press the F4 key to display the Properties window. Set the DatabaseName property to BIBLIO.MDB, and set the RecordSource property to the source table name Publishers.Add a Standard ListBox control to Form1. Select the ListBox control and press the F4 key to display the Properties window. Set the DataSource property to Data1, the DataField property to State, and the MultiSelect property to 2-Extended.Add the following to the Form Load event code:
Private Sub Form_Load()
List1.AddItem "CA"
List1.AddItem "WA"
List1.AddItem "PA"
List1.AddItem "MA"
List1.AddItem "IL"
List1.AddItem "FL"
End Sub
Start the program, or press the F5 key. Click next and previous on the data control and notice how the selection on the listbox does not change even though it is bound to the Data control. You can MultiSelect with CTRL+Click. When you go back into design mode the MultiSelect property is reset to 0-None, then when you run again, you get the correct behavior.Additional query words: kbVBp400 kbVBp600 kbdse kbDSupport kbVBp kbControl
Keywords : kbGrpDSVBDB
Issue type : kbprb
Technology : kbVBSearch kbAudDeveloper kbZNotKeyword6 kbZNotKeyword2 kbVB600Search kbVBA600 kbVB600 kbVB400Search kbVB400
Last Reviewed: January 11, 2001
---------------------------------------------------------------
Send feedback to Microsoft
© 2002 Microsoft Corporation. All rights reserved.