Problems with AddNew()

kbh123

New member
Joined
Apr 8, 2007
Messages
2
Programming Experience
Beginner
I am new to VB.NET working with VS2003.

I am trying to work with a database using a multitier approach. I have all my form code in my presentation tier and the actual code for database access in the data tier.

I can access my database and set data into the dataset I have created fine. I can navigate through the dataset using the bindingmanagerbase just fine. But when I try to use the AddNew to add a new record into the dataset, it adds a new record, but doesn't clear my textboxes so I can add in new info. I'm using the bindingmanagerbase.endcurrentedit and then the bindingmanagerbase.addnew.

When I put everything together by combining the presentation and data tiers into one, there are no problems, so I know there's a problem with the connection between the two tiers.

Does anybody have any previous experience with this?
 
perhaps the controls dont realise the bound data has changed, and dont refresh their contents? I cant help much because I'm not big into .NET 1.1 and .NET 2.0 does this rather differently..
 
Found problem, not sure what's causing it though.

I have found out what's causing the textboxes not to empty, but I'm not sure why it's happening. Maybe someone can shed some light on this.

I call a method to format the integers in the textboxes. Basically the code takes the event value in the parameter and converts it to currency. When I call that method, the textboxes won't clear during an AddNew(). If I don't call the format method, the textboxes clear like they're supposed to when calling AddNew().

The weird thing is I'm using a method copied directly from the MSDN Library to convert to currency(?) Guess I'm not using it correctly.


Anybody had any experience with this?:confused:
 
it's generally advised not to work with bound controls if you intend to format the value.. Create your own control, because the ropund trip from how the data is tored, to how it is displayed, back to how it is stored might not be an easy full circle for the computer to complete
 
Back
Top