Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 29th, 2003, 07:24 AM
Authorized User
Join Date: Nov 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to bind text box to recordset fields?

I am a new in using Visual Basic.

I am trying to use ADODB instead of ADODC in display a set of records to text box or table. Besides displaying records, updating, modifying and deleting are also able in order to manupulate those records.

I heard that by binding text box is able to do that. however, i got no idea on how to do it after so many tried.

Hope can get help from expertise.

Advanced thanks.

Old November 30th, 2003, 10:24 AM
Authorized User
Join Date: Jun 2003
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts

For your ADODC1 control set your .ConnectionString and .RecordSource. The .ConnectionString will tell VB what OLE DB driver to use and what database to read from. The .RecordSource will tell VB what table to use from the database. In your text box you need to set the .DataSource to the name of you ADODC1 control and the .DataField to the field you want to view.

Kenny Alligood
Old December 1st, 2003, 02:10 AM
Friend of Wrox
Join Date: Oct 2003
Posts: 336
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alyeng2000

another way to bind textfield to field data... use databinding collection this sample is from MSDN

dim bmCustomers As New BindingCollection
' Assuming an ADO Data Control configured to connect to the Customers
' table. The TextBox is named Text1; the code binds the CompanyName
' field to the Text property.

Private Sub UserForm_Initialize()
   Set bmCustomers.DataSource = ADODC1
   BmCustomers.Add TextBox1, "Text", "CompanyName"
end sub

Ahmed Ali
Software Developer

Similar Threads
Thread Thread Starter Forum Replies Last Post
bind recordset to field ibgreen SQL Language 0 October 24th, 2006 12:48 PM
Bind datagrid to recordset MAntis_sg Classic ASP Databases 0 May 15th, 2006 07:31 AM
Adding Fields to a Text Box Question ausmoran BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 1 December 1st, 2005 06:15 PM
Populating text box from RecordSet ersp Access VBA 5 April 4th, 2004 08:52 PM
Populating a text box from a RecordSet ersp Access 1 April 4th, 2004 04:22 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.