473,401 Members | 2,146 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,401 software developers and data experts.

Activate Save button in BindingNavigator

I have entered a BindingNavigator toolbar in a bound form and can manage to
browse records and I am able to enter data in a new record.
I am ot able to save the data and therefore I have entered the save-button.
How do I code this button to save a new record?
reidarT
Feb 23 '06 #1
1 20082
On Thu, 23 Feb 2006 21:54:50 +0100, "reidarT" <re****@eivon.no> wrote:
I have entered a BindingNavigator toolbar in a bound form and can manage to
browse records and I am able to enter data in a new record.
I am ot able to save the data and therefore I have entered the save-button.
How do I code this button to save a new record?
reidarT

I'm new at this myself, but this may help.

It depends on how your DataSet was filled. If from a single table (no
joins), a primary key exists, and none of the column names are
deliniated by "[ ]" in the fill SQL statement, the 'automated'
UpdateMethod should work.

Assuming a dataset named MyDataSet, a bindingsource named
MyBindingSoure, a tableadapter named MyTableAdapter and a table named
MyTable, this code would generally work if the above criteria are
satisfied:

Private Sub btnUpdate_Click(ByVal sender As Object, ByVal e As _
System.EventArgs) Handles btnUpdate.Click
If Me.Validate() = True Then
Me.MyBindingSource.EndEdit()
Me.MyTableAdapter.Update(Me.MyDataSet.MyTable)

Else
'there were validation errors
End If
End Sub

In the above example, the Update statement can throw an exception if
above criteria do not apply telling you that you need a valid Update
Command. I did somthing like this last week with an Access DB. At
first, the update would not work. Turned out that one of the columns
in the DB was named "Size" and appeared in the SQL statement as
[Size]. I renamed the column and the update then worked.

Gene
Feb 25 '06 #2

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

Similar topics

0
by: John | last post by:
Hi vs2005 rc. When I click on a "New" split button on the BindingNavigator a button_click event is produced and therefore a new record is added by the BindingNavigator. However when I click on...
2
by: Dave | last post by:
I have a c# program that uses the bindingnavigator control. It works fine, but I want to add the ability for a user to change his mind after clicking 'delete' to delete a record. So if the user...
4
by: Elton | last post by:
Dear All, I am new to vb , please help. I have a picture , and a picture_click( ) function. What I want to do is to have a simulate a click event onto the picture in a loop. However, when I...
3
by: michael sorens | last post by:
I have generated an XmlDocument, then bound it to a DataGridView (thanks to a pointer from PeterBromberg in a separate, recent posting). Now I want to connect a BindingNavigator, but my rudimentary...
7
by: Dale Sampson | last post by:
As you can tell, I am new to VS.net. I have a VB project with a defined data source pointing to a table in a ..mdb file.-- The associated fields are displayed in textboxes using the...
0
by: vishalsangwan | last post by:
Hi Everybody, I am writing an application using the bindingnavigator and the oledbDataAdapter. I am not able to save the changes to the actual access database. Please help me. The code follows. ...
1
by: vishalsangwan | last post by:
Hi Everybody, I am writing an application using the bindingnavigator and the oledbDataAdapter. I am not able to save the changes to the actual access database. Please help me. The code follows. ...
0
by: sincos | last post by:
Hello, First, sorry for my English, I hope you will understand me:) I'm new in using C Sharp and more with the bindingNavigator. What I would do is to simulate the button "add"...
2
by: ashukite | last post by:
I have an invoice form bind to a bindingsource and bindingnavigator. I use the bindingnavigator to add and save records. But I can's save data from an item combobox and total text box. The item...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
0
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
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...

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.