Results 1 to 2 of 2

Thread: Combobox not filling from dataset

  1. #1
    Hyperactive Member kxcntry99's Avatar
    Join Date
    Jun 06
    Location
    Pennsylvania
    Posts
    342

    Arrow Combobox not filling from dataset

    All:

    This is my first project using WPF and I have to say, its not going so well

    I am attempting to populate a combo box on the main window of my application however despite the dataset having data, the box remains empty. Please take a look and let me know what you think.

    Code:
    Private Sub MainWindow_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
            Dim cn_mysql As New MySqlConnection
            cn_mysql.ConnectionString = "Server=;Database=;Uid=;Pwd=;"
            Dim dsGetProcs As New DataSet
    
            Dim sqlGetProcs As String = "select Name from mysql.proc where db='test';"
            Dim daProcs As New MySqlDataAdapter(sqlGetProcs, cn_mysql)
            daProcs.Fill(dsGetProcs)
            daProcs.Dispose()
            cn_mysql.Close()
    
            cmboRoutine.DataContext = dsGetProcs.Tables(0).DefaultView
            cmboRoutine.DisplayMemberPath = "Name"
            cmboRoutine.SelectedValuePath = "Name"
    
        End Sub
    Microsoft Office Integration:Useful Database Links:
    Connection Strings


    Im a pogramar
    Iam a programer
    I’m a programor

    I write code!

  2. #2
    Frenzied Member Lightning's Avatar
    Join Date
    Oct 02
    Location
    Eygelshoven
    Posts
    1,556

    Re: Combobox not filling from dataset

    Shouldn't you use the itemsource in stead of datacontext.
    ?
    VB6 & C# (WCF LINQ) mostly


    If you need help with a WPF/WCF question post in the NEW WPF & WCF forum and we will try help the best we can

    My site

    My blog, couding troubles and solutions

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •