07-03-13, 10:37 AM
اهلا بك اخي ابورائد
هذا الكود وضعته في حدث اللود للفورم
وهذا وضعته في class
هذا الكود وضعته في حدث اللود للفورم
كود :
winclass.fillListBox(ListBox1, "Information", "[figure for]", "name", "")وهذا وضعته في class
كود :
Public Sub fillListBox(ByVal cbo As ListBox, ByVal tabl1 As String, ByVal col_name As String, ByVal col_value As String, ByVal whr As String)
Try
Dim comb As String
comb = ""
comb = "Select " + col_name + " , " + col_value + " From " + tabl1 + " " + whr
Dim sda As New SqlDataAdapter(comb, sqlcon)
Dim ds As New DataSet()
sda.Fill(ds)
cbo.DataSource = ds.Tables(0)
cbo.DisplayMember = col_name
cbo.ValueMember = col_value
Catch ex As Exception
End Try
End Sub
End Class