Dim cmd As New SQLCommand Dim dt As DataTable Dim lst As WinForm.ListBox = e.Form.Controls("ListBox1") cmd.C cmd.CommandText = "SELECT DISTINCT 商品类别 From {基本资料}"
dt = cmd.ExecuteReader() For Each dr As DataRow In dt.Datarows lst.Items.Add(dr("商品类别")) Next If Lst.Items.Count > 0 Then lst.SelectedIndex = 0 End If