473,508 Members | 4,179 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CurrencyManager Question

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

May 26 '06 #1
5 2076
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

<ha***********@hotmail.com> schreef in bericht
news:11**********************@y43g2000cwc.googlegr oups.com...
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

May 26 '06 #2
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

May 26 '06 #3
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

<ha***********@hotmail.com> schreef in bericht
news:11**********************@j33g2000cwa.googlegr oups.com...
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

May 27 '06 #4
Cor,

Do you have any example code that you would be willing to share?

Aaron

May 30 '06 #5
Aaron,

You mean something as this?

http://www.vb-tips.com/default.aspx?...8-2e91e5295e7c

Cor

"Aaron" <ha***********@hotmail.com> schreef in bericht
news:11**********************@j55g2000cwa.googlegr oups.com...
Cor,

Do you have any example code that you would be willing to share?

Aaron

May 30 '06 #6

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

Similar topics

1
2044
by: Pete Davis | last post by:
I have written a custom databound grid control that we've been using successfully for months, but one of our developers has just run into a problem that I can't figure out. The code for setting...
4
2794
by: Kris Bethea via DotNetMonster.com | last post by:
Greetings, I have a VB.NET program that I am trying to convert to C# (my office decided that we are going to use C# from now on). I've only been working with C# for about a month now, so this...
2
7788
by: web1110 | last post by:
I created a class derived from a DataGridTextBoxColumn. I have it working through looking at various examples on the net. To update the underlying DataGrid, I had to overload the Edit method...
1
2530
by: Christopher Weaver | last post by:
When I add a row to my DataTable my CurrencyManager doesn't know it's there. I have a ComboBox and a CurrencyManager bound to a DataTable such that a selection within the ComboBox causes all...
10
1863
by: D | last post by:
hi I have a form with 2 datagrids showing related table data in a master / child or order / order details type relationship. I would like to auto select the row in the order details table which...
4
4104
by: Jeremy | last post by:
I have a dataset containing 2 tables. A is the master table, B is a lookup table. There is a combobox bound to B, which updates a value in a FK field in A. my currencymanager is created thus:...
2
3241
by: Rich | last post by:
Hello, I have a datagrid (dgr1) on a form and I'm trying to bind a currencyManager Object (cma) to it and print the current row position. But all I get for cma.Position is 0, 0, 0 for any row...
3
4383
by: Brian Richardson | last post by:
Hi, Please can anyone kindly offer some suggestions as to why the CurrencyManager might not refresh. I am using the CurrencyManager to navigate through a DataView. I am aware that there is...
2
11447
by: Rich | last post by:
Hello, Following an example at http://www.vb-tips.com/dbpages.aspx?IA=DG (by Cor Lightert and Ken Tucker) on binding a dataRelation to a Datagridview for sqlClient, I was able to view rows...
0
3833
by: polocar | last post by:
Hi, I have noticed a strange behaviour of CurrencyManager objects in C# (I use Visual Studio 2005 Professional Edition). Suppose that you have a SQL Server database with 2 tables called "Cities"...
0
7228
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,...
1
7058
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5635
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5057
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3191
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1565
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.