combobox that's datadriven

jvcoach23

Centurion
Joined
May 22, 2003
Messages
192
Location
Saybrook, IL
I'm trying to bind an sp to a combobox with the dropdown style. I've created a connection and a sqlDataAdapter.. but my code doesn't seem to work...

Imports System.Data
Imports System.Data.SqlClient


Public Class Form3
Inherits System.Windows.Forms.Form

Dim myConnection As SqlConnection = New SqlConnection("server=(local);database=dts;uid=sa;password=notwhatImshowing")
Dim myAdapter As SqlDataAdapter = New SqlDataAdapter("spPackageName", myConnection)
Dim myDS As DataSet
Dim WithEvents myDV As DataView



Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Me.ComboBox1.DropDownStyle = ComboBoxStyle.DropDown
With Me
.myDS = New DataSet
.myAdapter.Fill(myDS)
.myDV = New DataView(myDS.Tables("spPackageName"))
.ComboBox1.DataSource = myDS
.myConnection.Open()
.myConnection.Close()


End With

End Sub


End Class


Sql I know.. vb.net I'm just trying to learn. Any help would be great.
 
Back
Top