473,385 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

DataGridView and Adding Entries

I have a DataGridView bound to a DataTable which is keyed on an Identity.

Now I want users to be able to fill in the table just by enetering data and tab
between fields and across row boundaries.

What I am having trouble with is deciding when to update the table and I keep on
getting exceptions (like DbNull).

Do you have to do an update at the end of each row ?

Also, there appears to be a difference when the table is initially empty - what
do I do in _DefaultValuesNeeded ?

Obviously, I am a bit confused, but there appear to be so many places where
defaults etc can be filled in. Can anyone point me to a definitive example of
DataGridView used this way ?
Apr 12 '06 #1
4 1801
Are you not using a BindingSource?

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"Ian Semmel" <is***********@NOKUNKrocketcomp.com.au> wrote in message
news:u5**************@TK2MSFTNGP03.phx.gbl...
I have a DataGridView bound to a DataTable which is keyed on an Identity.

Now I want users to be able to fill in the table just by enetering data
and tab between fields and across row boundaries.

What I am having trouble with is deciding when to update the table and I
keep on getting exceptions (like DbNull).

Do you have to do an update at the end of each row ?

Also, there appears to be a difference when the table is initially empty -
what do I do in _DefaultValuesNeeded ?

Obviously, I am a bit confused, but there appear to be so many places
where defaults etc can be filled in. Can anyone point me to a definitive
example of DataGridView used this way ?

Apr 13 '06 #2
So is that where I should be looking ?

Yes, I am using BindingSource (but not BindingNavigator)

I forgot to mention that in the DataGridView, some of the columns (including the
identity) are not visible (if that makes a difference)

Kevin Spencer wrote:
Are you not using a BindingSource?

Apr 13 '06 #3
Also, have you specified default values for database table columns that do
not allow null values?

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"Ian Semmel" <is***********@NOKUNKrocketcomp.com.au> wrote in message
news:eM**************@TK2MSFTNGP05.phx.gbl...
So is that where I should be looking ?

Yes, I am using BindingSource (but not BindingNavigator)

I forgot to mention that in the DataGridView, some of the columns
(including the identity) are not visible (if that makes a difference)

Kevin Spencer wrote:
Are you not using a BindingSource?

Apr 13 '06 #4
Does the database table that it is bound to allow nulls in the columns which
are empty when you try to update the DataTable? The DataTable should be
using the constraints set up by the database table, including allowing or
disallowing nulls.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"Ian Semmel" <is***********@NOKUNKrocketcomp.com.au> wrote in message
news:eM**************@TK2MSFTNGP05.phx.gbl...
So is that where I should be looking ?

Yes, I am using BindingSource (but not BindingNavigator)

I forgot to mention that in the DataGridView, some of the columns
(including the identity) are not visible (if that makes a difference)

Kevin Spencer wrote:
Are you not using a BindingSource?

Apr 13 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: bob | last post by:
Now this ought to be a simple matter. But nothing's simple in the Net world, I'm finding. In vb6 you could use "!" to force text to upper case in the format function. I've searched the vb.net...
7
by: Mitchell S. Honnert | last post by:
Is there an equivalent of the DataGrid's DataGridTableStyle for the DataGridView? If not, is there an easy way to duplicate the DataGridTableStyle's functionality for the DataGridView? Here's...
0
by: bemanian | last post by:
Hi, This is a simple DataGridView in a windows form which contains a number of other controls as buttons, text boxes and so on. The problem is when the data grid cell editing is conducted via...
5
by: DanThMan | last post by:
The situation: * I have a ButtonColumn in a DataGridView. * When the user preses one of the buttons, a dialog appears. * Based on what the user selects in the dialog, data is entered...
4
by: craig.wenger | last post by:
I am using a DataGridView to display information stored in classes. I am linking to the information with the Tag property of the DataGridView rows. Unfortunately, whenever I set the Tag property,...
4
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
how do you insert a new row to a databound datagridview? It won't allow this action.
3
by: jehugaleahsa | last post by:
Hello: I am binding a DataGridView with a BindingList<T>, where T is a custom business object that implements INotifyPropertyChanged. When you bind a DataGridView to a DataTable, it has this...
0
by: Queez | last post by:
OK, this is rediculous... Surely, sorting should be one of the easiest things with the ASP.NET DataGridView control. I mean, there's hundreds of sites out there (Microsoft MSDN entries included)...
3
by: Stewart Berman | last post by:
I have an application that populates a DataGridView control with an XML file: private void Form1_Load(object sender, EventArgs e) { dataGridView1.DataSource = gridDataSet;...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.