获取combobox

前端之家收集整理的这篇文章主要介绍了获取combobox前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
 '获取ComboBox
        Try
            Dim StrCon As String = Label1.Text
            Dim MyConn As OleDbConnection = New OleDbConnection()
            MyConn.ConnectionString = StrCon
            Dim StrCom As String = "sql"
            Dim MyData As New DataSet
            MyConn.Open()
            Dim mycom As OleDbDataAdapter = New OleDbDataAdapter(StrCom,MyConn)
            mycom.Fill(MyData,"1")
            ComboBox1.DataSource = MyData
            ComboBox1.DisplayMember = "1.1"
            ComboBox1.ValueMember = "1.2"
            MyConn.Close()
        Catch ex As Exception
            MsgBox("出错!")
        End Try
原文链接:https://www.f2er.com/vb/258655.html

猜你在找的VB相关文章