stop adding data[Resolved]
I'm call this sub in commandbutton , my problem is when user clicks it more than 1 click , data is added again (duplicated) .How can stop this ?
I thought of diabling the button but I don't want this way .
(I can't remember how could I did it in VB6 )
VB Code:
Public Shared Sub LoadColumns(ByRef listbox As ListBox)
Dim var As New Variables()
Dim str As String
var.MyAdapter.Fill(var.MyDataset, "MyTab")
Dim fields(var.MyDataset.Tables(0).Columns.Count - 1) As DataColumn
var.MyDataset.Tables(0).Columns.CopyTo(fields, 0)
listbox.Items.AddRange(fields)
End Sub