El código que tengo es el siguiente:
Código PHP:
Public Class Form1
Dim cadena As String = "Data Source=PC;Initial Catalog=MiBaseDatos;Integrated Security=True"
Dim con As SqlConnection
Dim sqltext As String
Dim DTT As DataTable
Sub abrir()
If IsNothing(con) Then
con = New SqlConnection(cadena)
Try
con.Open()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
End Sub
Sub Cargar_ComboBox()
abrir()
DTT = New DataTable
Dim adapter As New SqlDataAdapter("Select ID, Nombre from Table1", con)
Dim cmd As New SqlCommand(sqltext, con)
Me.CBPrueba.DataSource = DTT
adapter.Fill(DTT)
Me.CBPrueba.DisplayMember = "Nombre"
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Cargar_ComboBox()
Select Case CBPrueba.SelectedItem ("ID")
Case "1"
Me.TextBox1.Text = "Hola Mundo"
Case "2"
Me.TextBox1.Text = "Paco"
End Select
End Sub
End Class