Note that there are some explanatory texts on larger screens.

plurals
  1. POClicking on a listbox means I can't click on anything else on the form
    primarykey
    data
    text
    <p>I'm using a databound listbox in a C# WinForm application. </p> <p>When I click on an item in the listbox nothing else on the form works, even when I click on the close button the form doesn't close. Everything works fine until I select an item. </p> <p>What I have tried to do is in the listbox1_SelectedIndexChanged set the listbox1 focus to false but that didn't work. </p> <p>Code sample: This is the code that assigns the listbox to the data source:</p> <pre><code>this.ListBox1.DataBindings.Add(new System.Windows.Forms.Binding("SelectedValue", this.table1BindingSource, "PrimaryKeyId", true)); this.ListBox1.DataSource = this.table1BindingSource; this.ListBox1.DisplayMember = "Name"; this.ListBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.ListBox1.FormattingEnabled = true; this.ListBox1.ItemHeight = 24; this.ListBox1.Location = new System.Drawing.Point(185, 28); this.ListBox1.Name = "ListBox1"; this.ListBox1.Size = new System.Drawing.Size(660, 532); this.ListBox1.TabIndex = 7; this.ListBox1.ValueMember = "Name"; this.ListBox1.SelectedIndexChanged += new System.EventHandler(this.ListBox1_SelectedIndexChanged); </code></pre> <p>ListBox1 isn't referenced anywhere else. This is the initial code I was using before: </p> <pre><code>private void ListBox1_SelectedIndexChanged(object sender, EventArgs e) { ListBox1.Focus().Equals(false); } </code></pre> <p>This is the code I am now running: </p> <pre><code>private void ListBox1_SelectedIndexChanged(object sender, EventArgs e) { GroupBox1.Focus().Equals(true); } </code></pre> <p>Then on Windows load I have: <code>table1TableAdapter.Fill(this.Application1DataSet.Table1);</code> I've debug the windows load and the listbox1 method so I don't think it's a loop. Also the app doesn't crash so I don't think it's a loop.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload