Jump to content
xisto Community
Sign in to follow this  
dhanesh1405241511

Vb .net 2005 Bindingnavigator Help

Recommended Posts

As my earlier post mentioned about this small software i am trying to break my head with. Its a simple task of typing values into the field and when the "ENTER" button is hit it should add the values into the database and clear the text boxes and "Add a NEW row". This addition of new row is done through the Add New (Plus) button on the Binding Navigator bar. I dont need to manually press this button. I need to do the job of that plus button when i hit enter.

This is my code. Sorry its messed up with loads of comments but by time it was getting frustrating. I'd appriciate any small help on this. The events i mentioned after i hit ENTER are all under the button "btenter"

Public Class Form1	Private Sub CFRecordsBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)		Me.Validate()		Me.CFRecordsBindingSource.EndEdit()		Me.CFRecordsTableAdapter.Update(Me.KVCFDataSet.CFRecords)	End Sub	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load		'TODO: This line of code loads data into the 'KVCFDataSet.CFRecords' table. You can move, or remove it, as needed.		Me.CFRecordsTableAdapter.Fill(Me.KVCFDataSet.CFRecords)		NameTextBox.Focus()		NameTextBox.Text = ""		AgeTextBox.Text = ""		GenderTextBox.Text = ""		NationalityTextBox.Text = ""		UniversityCompanyTextBox.Text = ""		EmailIDTextBox.Text = ""		SpecializationTextBox.Text = "" 	End Sub	'Private Sub btenter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btenter.Click	'	Me.Validate()	'	Me.CFRecordsBindingSource.EndEdit()	'	Me.CFRecordsTableAdapter.Update(Me.KVCFDataSet.CFRecords)	'	NameTextBox.Text = ""	'	'AgeTextBox.Text = ""	'	GenderTextBox.Text = ""	'	NationalityTextBox.Text = ""	'	UniversityCompanyTextBox.Text = ""	'	EmailIDTextBox.Text = ""	'	SpecializationTextBox.Text = ""	'	NameTextBox.Focus()	'	'Dim nrow As DataRow = KVCFDataSet.CFRecords.NewRow	'	'nrow("Name") = NameTextBox.Text	'	'nrow("Age") = CInt(AgeTextBox.Text)	'	'nrow("Gender") = GenderTextBox.Text	'	'nrow("Nationality") = NationalityTextBox.Text()	'	'nrow("UniversityCompany") = UniversityCompanyTextBox.Text	'	'nrow("EmailID") = EmailIDTextBox.Text	'	'nrow("Specialization") = SpecializationTextBox.Text	'	'KVCFDataSet.CFRecords.Rows.Add(nrow)	'	'Me.CFRecordsTableAdapter.Update(Me.KVCFDataSet.CFRecords)	'End Sub	'Private Sub CFRecordsBindingSource_AddingNew(ByVal sender As Object, ByVal e As System.ComponentModel.AddingNewEventArgs) Handles CFRecordsBindingSource.AddingNew	'	Dim newrow As KVCFDataSet.CFRecordsRow	'	newrow = KVCFDataSet.CFRecords.NewRow	'	newrow.Name = NameTextBox.Text	'	newrow.Age = AgeTextBox.Text	'	newrow.Gender = GenderTextBox.Text	'	newrow.Nationality = NationalityTextBox.Text	'	newrow.UniversityCompany = UniversityCompanyTextBox.Text	'	newrow.EmailID = EmailIDTextBox.Text	'	newrow.Specialization = SpecializationTextBox.Text	'	KVCFDataSet.CFRecords.AddCFRecordsRow(newrow)	'	e.NewObject = newrow	'	CFRecordsBindingSource.Position = CFRecordsBindingSource.Count - 1	'End Sub	Private Sub BindingNavigatorAddNewItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorAddNewItem.Click	End Sub	Private Sub SpecializationTextBox_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles SpecializationTextBox.KeyDown		If e.KeyCode = Keys.Enter Then			Me.BindingNavigatorAddNewItem_Click(sender, e)			'BindingNavigatorAddNewItem_Click(sender, e)		End If	End Sub	Private Sub SpecializationTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SpecializationTextBox.TextChanged	End SubEnd Class

Regards
Dhanesh.

Share this post


Link to post
Share on other sites

Do you mind to attached the complete file for both form and code here, if possible the complete project, since it's a simple app. It would make us easier on helping you. Without the form file, we can't see what configuration has you configure for those control you placed on the form

Share this post


Link to post
Share on other sites

Do you mind to attached the complete file for both form and code here, if possible the complete project, since it's a simple app. It would make us easier on helping you. Without the form file, we can't see what configuration has you configure for those control you placed on the form

Here is the file .. If possible you can add me on msn or gmail, just let me know where and i'll pm you my ID
Thanks
Regards
Dhanesh.

Share this post


Link to post
Share on other sites

Try add

CFRecordsBindingSource.AddNew()

towards the end of your btenter_Click. I did that and it works out. Just not sure if that's what you want.

Share this post


Link to post
Share on other sites

Try add

CFRecordsBindingSource.AddNew()

towards the end of your btenter_Click. I did that and it works out. Just not sure if that's what you want.
Bingo ! This code works like a charm. I also tried it by adding this line to the btenter_Click
Me.CFRecordsTableAdapter.Fill(Me.KVCFDataSet.CFRecords)
This also works, incase anyone looking through this post would like an alternative.

Great healp lee, thanks again and i'll keep those questions shooting :ph34r:

Regards
Dhanesh.

Share this post


Link to post
Share on other sites

How to set datasource property of binding navigator control

Vb .net 2005 Bindingnavigator Help

 

Hi

 

I wanted to know how can set datasource property of bindingnavigator control dynamically.I have multiple databases based on the databse I select I want the binding navigator to work accordingly,can you Please help me

 

-deepthi

Share this post


Link to post
Share on other sites

How to get the next row data in the form by using a button

Vb .net 2005 Bindingnavigator Help

 

Hi there

Actually I am a programmer in VB 6.0 .Now need to do some work in VB.Net

And getting some problem

My question is

I have a Database which have a table called Notes which have some fields in it

Now I have VB.Net form which I have designed by putiing text and labels

Now I need to populate them withnotes database row at a time

I have a button in the form which when I press will give next row to me

I don't want to use bindingnavigator

Pleas help me with this

 

Regards

Vaibhav

 

-question by Vaibhav jindal

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.