Public Class Form4

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    ListBox1.Items.Add(InputBox("Masukkan jenama baru anda:"))
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    Dim s As New IO.StreamWriter("toner.dbo")
    For i As Integer = 0 To ListBox1.Items.Count - 1
        s.Write(ListBox1.Items(i) & vbNewLine)

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    If IO.File.Exists("toner.dbo") Then
        Dim r As New IO.StreamWriter("toner.dbo")
        Dim txt As New TextBox
        txt.Text = r.ReadToEnd

        For i As Integer = 0 To txt.Lines.Count - 2

    End If
End Sub

End Class

2 Years
Discussion Span
Last Post by Reverend Jim

What kind of database are you trying to add to? Is it MS-SQL, MySQL, Access, etc.? While a database could be a simple text file it usually is something more complex and can not be maintained with basic text I/O. Please provide more details and we'll try to help you.


Please provide with detailed info as Jim has said and also I don't think a program is capable of doing anything after stop debugging what I think you mean is "On Form Exit" which the code placed here are always executed before the program stop debugging or fully terminate or exit.

Also your codes are in a form of a poor programming as you didn't label the buttons accordingly for easy referral (so that we can see that this code is for this without having to read the entire code to see what is it for, and also no comments.

Try also to familiarize your self with those things they event help you easily spot the codes.


sorry for that and i still a newbie in programming so still got a lot of space to improve
by the way, i found a solution already.tq

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.