Adding/Saving a record

codes , .net , listbox , adding record , saving record Manila, Philippines
  • 10 years ago

    Hi. I'm new to VB.Net.

    I've used the youtube tutorial coding here: http://www.youtube.com/watch?v=BVS2_PdjlWQ

    MsgBox says that the record has been added but my listbox is still empty and the db is not updated. How's that going to be fixed? PLEASE HELP. Here's my code:

    Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click

        ViewEmpDetails.TblEmpDetailsTableAdapter.Insert(Me.txtEmpID.Text, Me.txtLastName.Text, _
                                                        Me.txtFirstName.Text, Me.txtMidName.Text, _
                                                        Me.txtAddress.Text, Me.txtBirthday.Text, _
                                                        Me.txtContact.Text, Me.txtStatus.Text, _
                                                         Me.txtCitizenship.Text, Me.txtTin.Text, _
                                                         Me.txtPagibig.Text, Me.txtSSS.Text, _
                                                         Me.txtPhilHealth.Text, Me.txtPagibig.Text)
    
        ViewEmpDetails.TblEmpDetailsTableAdapter.Fill(ViewEmpDetails.Time_and_AttendanceDataSet.tblEmpDetails)
    
        MsgBox("Record has been Added")
    
        For Each item As Control In Me.Controls
            If TypeOf item Is TextBox Then
                item.Text = String.Empty
            End If
    
        Next
    
        Me.Close()
    
        ViewEmpDetails.Show()
    
    
    End Sub
    

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“We better hurry up and start coding, there are going to be a lot of bugs to fix.”