Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Vb .net 2005 Bindingnavigator Help
dhanesh
post Apr 28 2007, 05:50 PM
Post #1


Binary Geek
Group Icon

Group: Members
Posts: 444
Joined: 4-November 05
From: The Digital Arena
Member No.: 9,440



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.


Go to the top of the page
 
+Quote Post
faulty.lee
post Apr 28 2007, 06:12 PM
Post #2


Premium Member
Group Icon

Group: [HOSTED]
Posts: 495
Joined: 5-November 06
Member No.: 17,016



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
Go to the top of the page
 
+Quote Post
dhanesh
post Apr 28 2007, 06:34 PM
Post #3


Binary Geek
Group Icon

Group: Members
Posts: 444
Joined: 4-November 05
From: The Digital Arena
Member No.: 9,440



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.
Go to the top of the page
 
+Quote Post
faulty.lee
post Apr 29 2007, 11:27 AM
Post #4


Premium Member
Group Icon

Group: [HOSTED]
Posts: 495
Joined: 5-November 06
Member No.: 17,016



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.
Go to the top of the page
 
+Quote Post
dhanesh
post Apr 29 2007, 04:01 PM
Post #5


Binary Geek
Group Icon

Group: Members
Posts: 444
Joined: 4-November 05
From: The Digital Arena
Member No.: 9,440



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.
Go to the top of the page
 
+Quote Post
faulty.lee
post Apr 30 2007, 12:39 AM
Post #6


Premium Member
Group Icon

Group: [HOSTED]
Posts: 495
Joined: 5-November 06
Member No.: 17,016



You're welcome, glade that helps
Go to the top of the page
 
+Quote Post
iGuest
post Feb 13 2008, 06:10 AM
Post #7


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 0
Joined: 1-November 07
Member No.: 25,869



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
Go to the top of the page
 
+Quote Post
iGuest
post May 15 2008, 07:09 AM
Post #8


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 0
Joined: 1-November 07
Member No.: 25,869



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
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. New Features In Visual Studio 2005 Windows Forms(1)


 



- Lo-Fi Version Time is now: 13th October 2008 - 03:44 PM