0

hi iam a noob in vb programming
and iam making a vb.net program to create a database of my shop...

the code of my program is

Public Class form1

    Private i As Integer = 0
    Private myCoolFile As String = "C:\test" & i & ".txt" '// your file

    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        Dim myWriter As New IO.StreamWriter(myCoolFile)
        For Each myItem As ListViewItem In ListView1.Items
            myWriter.WriteLine(myItem.Text & "#" & myItem.SubItems(1).Text) '// write Item and SubItem.
        Next
        myWriter.Close()
    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Timer1.Start()
        If IO.File.Exists(myCoolFile) Then '// check if file exists.
            Dim myCoolFileLines() As String = IO.File.ReadAllLines(myCoolFile) '// load your file as a string array.
            For Each line As String In myCoolFileLines '// loop thru array list.
                Dim lineArray() As String = line.Split("#") '// separate by "#" character.
                Dim newItem As New ListViewItem(lineArray(0)) '// add text Item.
                newItem.SubItems.Add(lineArray(1)) '// add SubItem.
                ListView1.Items.Add(newItem) '// add Item to ListView.
            Next
        End If
    End Sub




    Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim Str(4) As String
        Dim newItm As ListViewItem
        Dim c As Integer
        c = ListView1.Items.Count
        c += 1
        Str(0) = Convert.ToString(c & ".")
        Str(1) = TextBox1.Text.ToString()
        Str(2) = TextBox2.Text.ToString()
        Str(3) = TextBox3.Text.ToString()

        newItm = New ListViewItem(Str(0))


        With ListView1.Items.Add(newItm)
            .SubItems.Add(txt_product.Text)
            .SubItems.Add(txt_quantity.Text)
            .SubItems.Add(Describtion.Text)
            .SubItems.Add(txt_company.Text)
            .SubItems.Add(txt_cateogry.Text)
            .SubItems.Add(txt_sub_cateogry.Text)
            .SubItems.Add(txt_mrp.Text)
            .SubItems.Add(txt_dp.Text)



        End With
        Static i As Integer = 0

        i += 1
    End Sub

    Private Sub Form1_Load_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ListView1.View = View.Details
        ListView1.Columns.Add("Serial No.", 60, HorizontalAlignment.Left)
        ListView1.Columns.Add("Product", 160, HorizontalAlignment.Left)




        ListView1.Columns.Add("Quantity", 60, HorizontalAlignment.Left)
        ListView1.Columns.Add("Describtion", 180, HorizontalAlignment.Left)
        ListView1.Columns.Add("Company", 90, HorizontalAlignment.Left)
        ListView1.Columns.Add("Cateogry", 90, HorizontalAlignment.Left)
        ListView1.Columns.Add("Sub-Cateogry", 80, HorizontalAlignment.Left)
        ListView1.Columns.Add("MRP", 60, HorizontalAlignment.Left)
        ListView1.Columns.Add("DP", 60, HorizontalAlignment.Left)
    End Sub

    Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        For Each lsvrow As ListViewItem In ListView1.SelectedItems
            ListView1.Items.Remove(lsvrow)
        Next
    End Sub



    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        For Each LItem As ListViewItem In ListView1.SelectedItems
            LItem.Remove()
        Next
    End Sub



    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

        Label9.Text = DateTime.Now
    End Sub


End Class

http://i44.tinypic.com/2gv6ji1.jpg

i want to make this program so that i can add the data every week and a new txt document is added every week,
then i want to compare the data of both weeks....

please help me

and remember iAM a noob

2
Contributors
1
Reply
14
Views
3 Years
Discussion Span
Last Post by tinstaafl
0

Your first step should be to flag your post and send the message that the post needs to be moved to the VB.net forum.

This topic has been dead for over six months. 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.