[dba-VB] Does anyone have

Charlotte Foust cfoust at infostatsystems.com
Mon Dec 10 13:32:12 CST 2007


John, 

Can't recommend a tutorial offhand, but we do this all the time.  You
normally bind the form to a dataset at design time, but you can do it
after the fact if necessary. Question is, what exactly do you mean by
"create on the form" and then somehow bind?  Are you talking about
dropping controls on the form at runtime, a la a control array in VB, or
something else?  In either case, the keyword is DataBindings, which will
allow you to take a new recordset and set the objects binding to that
recordset.  What we do is declare a couple of object variables as
bindings, one old and one new.  Then we create an arraylist for bindings
to remove and bindings to add.  After that, it's a matter of stepping
through the controls, identifying the bound controls and examining their
binding.  If the oldbinding DataSource is the old datasource, then we
populate NewBindings with a new binding using the original binding
property name but the new datasource without removing the old binding.
We add the original binding to the oldbindings arraylist and the new
binding to the newbindings arraylist.  When that's all done, we remove
the old bindings and add the new ones.

Charlotte Foust

-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Monday, December 10, 2007 10:22 AM
To: dba-vb at databaseadvisors.com
Subject: [dba-VB] Does anyone have

A good tutorial for displaying / editing / saving data in VB.Net 2005?
A recommended book?

I want a form that displays records in a table in SQL Server.  I do NOT
want to use a continuous or grid control, but rather a set of controls
that I create on the form and then somehow "bind" to the data.  The form
should have the typical VCR controls for moving through the data.  The
form should be capable of displaying, updating and saving changes.  I
have the typical parent child relationships so it would be nice if I
could also learn how to display child data in sub forms or the .Net
equivalent as the parent moves through it's records.

We all know I have always been a "bound" kind of guy in Access.  VB.Net
is a new beastie and I am certainly willing to learn new things, so
unbound is fine as long as data integrity is maintained, changes by
other users respected and so forth.  I am no longer a complete nubee to
.Net but I am also by no stretch an interface wizard so It will need to
start from the beginning and explain every step.

I have a ton of VB.Net books but they all seem to want to bind to the
grid control.

John W. Colby
Colby Consulting
www.ColbyConsulting.com 

_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com





More information about the dba-VB mailing list