Wrox Programmer Forums
|
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics 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 March 1st, 2007, 03:47 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default DataGridView Behavior Qs

Man!
I just cannot seem to find any straight-forward explanations about anything in .NET. Everything is part of some particular task being solved.

“Let’s say we want to set up a used car dealership . . . ” Great. I learn how to solve the suggested problem, but it is like searching for a needle in a haystack to find the behavior of the control in a category not covered in the problem being solved.

So.

When you edit info in rows of a DataGridView (DGV), are all changes to all rows held until you use some update method, or do saves have to be undertaken anytime you move to a new row after editing?

When adding rows, are all additions stored until the datasource is updated, or do you have to perform an update for each row, 1 at a time?

Is there an event that fires when an update needs to be done to avoid losing data?

Is there a property that indicates the data are dirty?

I am using the following, which I found in VS ’05 Help. It properly fills in my DGV:
Code:
Private dtAdptr As New OracleDataAdapter()
Private BndgSrc As New BindingSource()

Private Sub FormLoad(ByVal sender As Object, _
                     ByVal e As System.EventArgs) _
                     Handles Me.Load

   ' Me.DataGrid is the control on the form.
   Me.DataGrid.DataSource = Me.BndgSrc

   Me.dtAdptr = New OracleDataAdapter("<valid SQL>", _
                                      "<valid Connection String>")

   Dim CmdBldr As New OracleCommandBuilder(Me.dtAdptr)  
   ' The statement above is what was suggested in Help,
   ' but CmdBldr is never used.  Is this intended as a 
   ' statement that modifies the DataAdapter?

   Dim dt As New DataTable()
   Me.dtAdptr.Fill(dt)
   Me.BndgSrc.DataSource = dt

   Me.DataGrid.AutoResizeColumns( _
      DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader)

End Sub
When it is time to update the data, what are the necessary steps?

I need to not use VS tools to set this up. The form is generic, and is loaded with data dynamically. the form does not specifiy the data source until it is manipulated prior to being shown.

So instructions on how to drag this—N—that from the tool box onto the form and fill it in with a wizard will be less than helpful.

Any suggestions on a book or on books that describe the performance of controls outside a proposed task? I am looking for something like a cookbook, aor a BlackBook. You look up the control, and the control is defined, along with the steps that need to be taken to make it operate.

For instance, with the DGV, a description of the various ways to fill it with data (with a brief sample of each), a description of how to save edits (with a breif sample of each), and so on, presented in a way that doesn't require reading back 5 chapters to follow the development of the "scenario."

Suggestions?





Similar Threads
Thread Thread Starter Forum Replies Last Post
2 DB_related Qs about VWD & SQLExpress garaxan ADO.NET 0 August 29th, 2007 04:36 AM
Qs! asadullah Java Basics 1 April 16th, 2007 11:35 PM
DataGridView Behavior Qs BrianWren Pro Visual Basic 2005 0 March 1st, 2007 03:49 PM
Chapter 1: Building an ASP.NET Website Qs & As groupmatch BOOK: ASP.NET Website Programming Problem-Design-Solution 4 August 27th, 2004 08:57 AM





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