Nov 23, 2009

Vb .net 2005 Bindingnavigator Help

free web hosting
Open Discussion & Free Web Hosting > Computers & Tech > Programming > Programming General > BASIC / Visual Basic (.NET)

Vb .net 2005 Bindingnavigator Help

dhanesh
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"

CODE
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 Sub
End Class


Regards
Dhanesh.


 

 

 


Comment/Reply (w/o sign-up)

faulty.lee
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

Comment/Reply (w/o sign-up)

dhanesh
QUOTE(faulty.lee @ Apr 28 2007, 10:12 PM) *
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.

Comment/Reply (w/o sign-up)

faulty.lee
Try add

CODE
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.

Comment/Reply (w/o sign-up)

dhanesh
QUOTE(faulty.lee @ Apr 29 2007, 03:27 PM) *
Try add

CODE
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
CODE
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 wink.gif

Regards
Dhanesh.

 

 

 


Comment/Reply (w/o sign-up)

faulty.lee
You're welcome, glade that helps

Comment/Reply (w/o sign-up)

FeedBacker
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

Comment/Reply (w/o sign-up)

FeedBacker
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

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)


See Also,

*SIMILAR VIDEOS*
Searching Video's for vb, net, 2005, bindingnavigator
advertisement



Vb .net 2005 Bindingnavigator Help

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com