CurrencyManager Question

  • Thread starter Thread starter hartley_aaron
  • Start date Start date
H

hartley_aaron

Hi,

CurrencyManger has a method called AddNew which well create a new
record in the data that it is bound to (ie a new datarow in a table).
The new record has null values for all of its elements. What I would
like to have is the ability to add a new record using the current
values of the TextBox fields that have been bound to the datasource.

I have tried various solutions to have the code edit the record using
the current values after it has been created, but the null values cause
a 'System.Data.NoNullAllowedException' error. Here is one attempt:

objCurrencyManager.AddNew()
objCurrencyManager.EndCurrentEdit()

Any ideas?

Thanks,
Aaron
 
Hartley,

Seems difficult to me, because when you use whatever AddNew method than
there will be a new row created. The CurrencyManager AddNew set direct the
pointer to this new added row and therefore your textbox is nothing at that
moment.

In my opinion is what you try to do not in the line of binded bounds or in
other words.
It does me reminds on that Jewish Witz (joke), that I have more times writen
in this newsgroup.


Cor
 
Cor,
It does me reminds on that Jewish Witz (joke), that I have more times writen
in this newsgroup.

The null row is the heavy stone!

In the past I always have coded everything directly against the
datatables. This works great except that I end up with a lot of code
which creates more maintenance overhead. I wanted to try binding and
see if it would be an improvement.

The example in my VS book has the code insert the row into the database
and then reload the datatable from the database. This skirts around
the issue entirely. While this method keeps the datatable very
current, it also has higher network and processing overhead. Some
situations may call for this while others may call for something more
detached and efficient.

Is the AddNew method totally worthless?

Aaron
 
I don't think it is worthless, only you have to use an add button first
before you start entering. That is just two times expirience and it is done.

The update button does than everything as well for other updates, but than
complete for all changed rows.

Just my thought,

Cor
 
Back
Top