0
Private Sub AddIngoing_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       
        loadprodin()
      
    End Sub

Private Sub loadprodin()

        Dim i As Integer

        objCon = New SqlConnection(conStr)

        Try
            objCon.Open()
            obj = objCon.CreateCommand()
            str = "Select * from product ORDER BY p_code"

            obj.CommandText = str
            sda.SelectCommand = obj
            sda.Fill(ds, "product")
            dt = ds.Tables("product")
            obj.ExecuteNonQuery()
            For i = 0 To dt.Rows.Count - 1
                ComboBox2.Items.Add(dt.Rows(i).Item(1))
            Next
        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Error conection!!")
        End Try

    End Sub

my problem is when i close this form and reopenit the data in the combobox load again. i mean for example in first load in the form only 1 data in combobox after i reload the form the data was duplicate in the combobox. how to prevent it? i don't want to duplicate that data.

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Jx_Man
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.