Bound ComboBox "Bug"? 
Author Message
 Bound ComboBox "Bug"?

I believe that I have found a bug in the ComboBox class but was
wondering if someone could confirm this or show me what I am doing
wrong. The following code sample demonstrates the problem.

Imports System.Data.SqlClient

Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form
Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox
    Friend WithEvents ListBox1 As System.Windows.Forms.ListBox
    Friend WithEvents Label1 As System.Windows.Forms.Label
    <System.Diagnostics.De{*filter*}StepThrough()> Private Sub
InitializeComponent()
        Me.ComboBox1 = New System.Windows.Forms.ComboBox()
        Me.ListBox1 = New System.Windows.Forms.ListBox()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.SuspendLayout()
        '
        'ComboBox1
        '
        Me.ComboBox1.Location = New System.Drawing.Point(36, 40)
        Me.ComboBox1.Name = "ComboBox1"
        Me.ComboBox1.Size = New System.Drawing.Size(200, 21)
        Me.ComboBox1.TabIndex = 0
        '
        'ListBox1
        '
        Me.ListBox1.Location = New System.Drawing.Point(36, 112)
        Me.ListBox1.Name = "ListBox1"
        Me.ListBox1.Size = New System.Drawing.Size(232, 134)
        Me.ListBox1.TabIndex = 1
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(36, 80)
        Me.Label1.Name = "Label1"
        Me.Label1.TabIndex = 2
        Me.Label1.Text = "Current Text:"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(292, 266)
        Me.Controls.AddRange(New System.Windows.Forms.Control()
{Me.Label1, Me.ListBox1, Me.ComboBox1})
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

        Dim strSelect As String = "SELECT stor_id, stor_name FROM
stores"
        Dim SQLConnectionString As String = "data source=
(localhost);initial catalog=pubs;integrated security=SSPI"
        Dim da As New SqlDataAdapter(strSelect, SQLConnectionString)

        Dim ds As New DataSet("Pubs")

        da.Fill(ds, "stores")

        With ComboBox1
            .Sorted = True
            .DataSource = ds.Tables("stores")
            .DisplayMember = "stor_name"
            .ValueMember = "stor_id"
        End With

    End Sub

    Private Sub ComboBox1_TextChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ComboBox1.TextChanged
        ListBox1.Items.Add(ComboBox1.Text)
    End Sub
End Class

When you first run this form (be sure to change the connection string to
point to your SQL Server) and the ComboBox has the item "Barnum's" from
the data source preselected. The listbox is used to display what the
system thinks the .Text property of the ComboBox is on each TextChanged
event fire. Notice, when you first enter the field, if you type one
letter, i.e. e, the .Text still gives you the value of Barnum's. It is
like it totally ignored the letter typed. But if you type a second
letter, then the .Text reflects both letters that you have typed. This
does not happen if the ComboBox is used in an unbound mode.

Any thoughts?



Sun, 05 Dec 2004 00:02:35 GMT  
 Bound ComboBox "Bug"?
It is a known problem that will be fixed in future release of the product.
Sorry about that!

Karol Zadora, SDE
Holly Gagne, SDET

--
This posting is provided "AS IS" with no warranties, and confers no rights.


Quote:
> I believe that I have found a bug in the ComboBox class but was
> wondering if someone could confirm this or show me what I am doing
> wrong. The following code sample demonstrates the problem.

> Imports System.Data.SqlClient

> Public Class Form1
>     Inherits System.Windows.Forms.Form

> #Region " Windows Form Designer generated code "

>     Public Sub New()
>         MyBase.New()

>         'This call is required by the Windows Form Designer.
>         InitializeComponent()

>         'Add any initialization after the InitializeComponent() call

>     End Sub

>     'Form overrides dispose to clean up the component list.
>     Protected Overloads Overrides Sub Dispose(ByVal disposing As
> Boolean)
>         If disposing Then
>             If Not (components Is Nothing) Then
>                 components.Dispose()
>             End If
>         End If
>         MyBase.Dispose(disposing)
>     End Sub

>     'Required by the Windows Form Designer
>     Private components As System.ComponentModel.IContainer

>     'NOTE: The following procedure is required by the Windows Form
> Designer
>     'It can be modified using the Windows Form Designer.
>     'Do not modify it using the code editor.
>     Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox
>     Friend WithEvents ListBox1 As System.Windows.Forms.ListBox
>     Friend WithEvents Label1 As System.Windows.Forms.Label
>     <System.Diagnostics.De{*filter*}StepThrough()> Private Sub
> InitializeComponent()
>         Me.ComboBox1 = New System.Windows.Forms.ComboBox()
>         Me.ListBox1 = New System.Windows.Forms.ListBox()
>         Me.Label1 = New System.Windows.Forms.Label()
>         Me.SuspendLayout()
>         '
>         'ComboBox1
>         '
>         Me.ComboBox1.Location = New System.Drawing.Point(36, 40)
>         Me.ComboBox1.Name = "ComboBox1"
>         Me.ComboBox1.Size = New System.Drawing.Size(200, 21)
>         Me.ComboBox1.TabIndex = 0
>         '
>         'ListBox1
>         '
>         Me.ListBox1.Location = New System.Drawing.Point(36, 112)
>         Me.ListBox1.Name = "ListBox1"
>         Me.ListBox1.Size = New System.Drawing.Size(232, 134)
>         Me.ListBox1.TabIndex = 1
>         '
>         'Label1
>         '
>         Me.Label1.Location = New System.Drawing.Point(36, 80)
>         Me.Label1.Name = "Label1"
>         Me.Label1.TabIndex = 2
>         Me.Label1.Text = "Current Text:"
>         '
>         'Form1
>         '
>         Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
>         Me.ClientSize = New System.Drawing.Size(292, 266)
>         Me.Controls.AddRange(New System.Windows.Forms.Control()
> {Me.Label1, Me.ListBox1, Me.ComboBox1})
>         Me.Name = "Form1"
>         Me.Text = "Form1"
>         Me.ResumeLayout(False)

>     End Sub

> #End Region

>     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load

>         Dim strSelect As String = "SELECT stor_id, stor_name FROM
> stores"
>         Dim SQLConnectionString As String = "data source=
> (localhost);initial catalog=pubs;integrated security=SSPI"
>         Dim da As New SqlDataAdapter(strSelect, SQLConnectionString)

>         Dim ds As New DataSet("Pubs")

>         da.Fill(ds, "stores")

>         With ComboBox1
>             .Sorted = True
>             .DataSource = ds.Tables("stores")
>             .DisplayMember = "stor_name"
>             .ValueMember = "stor_id"
>         End With

>     End Sub

>     Private Sub ComboBox1_TextChanged(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles ComboBox1.TextChanged
>         ListBox1.Items.Add(ComboBox1.Text)
>     End Sub
> End Class

> When you first run this form (be sure to change the connection string to
> point to your SQL Server) and the ComboBox has the item "Barnum's" from
> the data source preselected. The listbox is used to display what the
> system thinks the .Text property of the ComboBox is on each TextChanged
> event fire. Notice, when you first enter the field, if you type one
> letter, i.e. e, the .Text still gives you the value of Barnum's. It is
> like it totally ignored the letter typed. But if you type a second
> letter, then the .Text reflects both letters that you have typed. This
> does not happen if the ComboBox is used in an unbound mode.

> Any thoughts?



Mon, 06 Dec 2004 03:46:32 GMT  
 Bound ComboBox "Bug"?
Thanks for the response. Is there anywhere that you know of where I
cound find a list of the currently "known" issues that have not been
resolved yet? This could really shorten debugging times if one could
identify an issue as a known problem and move on.

Thanks

Kevin Hartman


says...

Quote:
> It is a known problem that will be fixed in future release of the product.
> Sorry about that!

> Karol Zadora, SDE
> Holly Gagne, SDET

> --
> This posting is provided "AS IS" with no warranties, and confers no rights.



Sat, 11 Dec 2004 04:25:55 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. *"*-.,._,.-*"* I"LL TRADE VISUAL C++ FOR VBASIC *"*-.,_,.-*"*

2. Combobox like "Run" of Windows

3. ComboBox interesting "feature"...

4. Problem with "Binding" in QB

5. ComboBox "DropDown"

6. ComboBox "AutoExpand"

7. ComboBox "ListRows"?

8. ComboBox "Value List"

9. Crystal Smart Viewer "cannot create binding"

10. Can't "bind"

11. "Unable to bind to field" message

12. Strange "bug?" in VS

 

 
Powered by phpBB® Forum Software