Hello I have come across some strange symptoms associated with retrieving data for a bound UltraComboEditor control. I have provided code to reproduce this problem I'm having. The problem is:
When you run the example the comboBoxes on the left are not bound until you click the button to the left. When this button is clicked the UltraComboBoces are bound each to an unique table in the typed DataSet. Immediately after PopulateTables is called to put 1000 rows of data into each table. (populate tables is meant to mimic a call to a back end for data). This process takes ~20ms.
The second set of comboBoxes (on the right) were previously bound in the designer (thus their bindings are assigned in InitializeComponent. When you click the button beside these we call PopulateTables. This takes ~ 13000ms or ~13 seconds to fill the comboBoxes.
My question is, why does this happen? The 13 seconds of lag is intolerable. This makes absolutely no sense to me why filling on one set takes ~22ms and the other set takes ~13000ms.
To get the code to work. Open a new WindowsApplication Project in VS and just replace the program.cs text with the following code.
static class Program1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form5());
}
class TypedDataSet : DataSet
public TypedDataSet()
DataTable t1 = new DataTable();
t1.Columns.Add("one", typeof(string));
t1.Columns.Add("two", typeof(string));
t1.TableName = "TableOne";
this.Tables.Add(t1);
DataTable t2 = new DataTable();
t2.Columns.Add("one", typeof(string));
t2.Columns.Add("two", typeof(string));
t2.TableName = "TableTwo";
this.Tables.Add(t2);
DataTable t3 = new DataTable();
t3.Columns.Add("one", typeof(string));
t3.Columns.Add("two", typeof(string));
t3.TableName = "TableThree";
this.Tables.Add(t3);
DataTable t4 = new DataTable();
t4.Columns.Add("one", typeof(string));
t4.Columns.Add("two", typeof(string));
t4.TableName = "TableFour";
this.Tables.Add(t4);
public partial class Form5 : Form
Random rnd = new Random();
public static Stopwatch stopwatch1 = new Stopwatch();
public Form5()
InitializeComponent();
private void button1_Click(object sender, EventArgs e)
List<UltraComboEditor> uceList = new List<UltraComboEditor>();
uceList.Add(ultraComboEditor1);
uceList.Add(ultraComboEditor2);
uceList.Add(ultraComboEditor3);
uceList.Add(ultraComboEditor4);
TypedDataSet tds = new TypedDataSet();
for (int i = 0; i < tds.Tables.Count; i++)
UltraComboEditor uce = uceList[i];
uce.DataSource = tds;
uce.DataMember = tds.Tables[i].TableName;
uce.DisplayMember = tds.Tables[i].TableName + ".one";
stopwatch1.Reset();
stopwatch1.Start();
PupulateTables(tds);
stopwatch1.Stop();
MessageBox.Show("Time taken: " + stopwatch1.ElapsedMilliseconds + "ms");
private void button3_Click(object sender, EventArgs e)
PupulateTables(typedDataSet1);
private void PupulateTables(DataSet dataSet1)
foreach (DataTable dt in dataSet1.Tables)
PopulateTable(dt, 1000);
/// Populates a table with a specified number of rows.
/// <param name="t">The table.</param>
/// <param name="rows">The rows.</param>
public void PopulateTable(DataTable t, int rows)
for (int i = 0; i < rows; i++)
DataRow dtrRow = t.NewRow();
for (int co = 0; co < dtrRow.ItemArray.Length; co++)
dtrRow[co] = GetRandomString(4);
t.Rows.Add(dtrRow);
/// Gets the random string.
/// <param name="length">The length.</param>
/// <returns></returns>
public string GetRandomString(int length)
string charPool
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvw xyz1234567890";
StringBuilder rs = new StringBuilder();
int counter = 0;
while (counter != length)
rs.Append(charPool[rnd.Next(0, charPool.Length)]);
counter++;
return rs.ToString();
#region Windows Form Designer generated code
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
private void InitializeComponent()
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form4));
this.ultraComboEditor1 = new Infragistics.Win.UltraWinEditors.UltraComboEditor();
this.ultraComboEditor2 = new Infragistics.Win.UltraWinEditors.UltraComboEditor();
this.ultraComboEditor3 = new Infragistics.Win.UltraWinEditors.UltraComboEditor();
this.ultraComboEditor4 = new Infragistics.Win.UltraWinEditors.UltraComboEditor();
this.button1 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.ultraComboEditor8 = new Infragistics.Win.UltraWinEditors.UltraComboEditor();
this.typedDataSet1 = new DataBindingLagProblem.TypedDataSet();
this.ultraComboEditor5 = new Infragistics.Win.UltraWinEditors.UltraComboEditor();
this.ultraComboEditor6 = new Infragistics.Win.UltraWinEditors.UltraComboEditor();
this.ultraComboEditor7 = new Infragistics.Win.UltraWinEditors.UltraComboEditor();
((System.ComponentModel.ISupportInitialize)(this.ultraComboEditor1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ultraComboEditor2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ultraComboEditor3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ultraComboEditor4)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ultraComboEditor8)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.typedDataSet1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ultraComboEditor5)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ultraComboEditor6)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ultraComboEditor7)).BeginInit();
this.SuspendLayout();
//
// ultraComboEditor1
this.ultraComboEditor1.Location = new System.Drawing.Point(105, 12);
this.ultraComboEditor1.Name = "ultraComboEditor1";
this.ultraComboEditor1.Size = new System.Drawing.Size(144, 21);
this.ultraComboEditor1.TabIndex = 0;
this.ultraComboEditor1.Text = "ultraComboEditor1";
// ultraComboEditor2
this.ultraComboEditor2.Location = new System.Drawing.Point(105, 39);
this.ultraComboEditor2.Name = "ultraComboEditor2";
this.ultraComboEditor2.Size = new System.Drawing.Size(144, 21);
this.ultraComboEditor2.TabIndex = 1;
this.ultraComboEditor2.Text = "ultraComboEditor2";
// ultraComboEditor3
this.ultraComboEditor3.Location = new System.Drawing.Point(105, 66);
this.ultraComboEditor3.Name = "ultraComboEditor3";
this.ultraComboEditor3.Size = new System.Drawing.Size(144, 21);
this.ultraComboEditor3.TabIndex = 2;
this.ultraComboEditor3.Text = "ultraComboEditor3";
// ultraComboEditor4
this.ultraComboEditor4.Location = new System.Drawing.Point(105, 93);
this.ultraComboEditor4.Name = "ultraComboEditor4";
this.ultraComboEditor4.Size = new System.Drawing.Size(144, 21);
this.ultraComboEditor4.TabIndex = 3;
this.ultraComboEditor4.Text = "ultraComboEditor4";
// button1
this.button1.Location = new System.Drawing.Point(12, 5);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(87, 23);
this.button1.TabIndex = 4;
this.button1.Text = "Bind";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
// button3
this.button3.Location = new System.Drawing.Point(288, 5);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(87, 23);
this.button3.TabIndex = 10;
this.button3.Text = "Bind";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
// ultraComboEditor8
this.ultraComboEditor8.DataMember = "TableFour";
this.ultraComboEditor8.DataSource = this.typedDataSet1;
this.ultraComboEditor8.DisplayMember = "one";
this.ultraComboEditor8.Location = new System.Drawing.Point(381, 93);
this.ultraComboEditor8.Name = "ultraComboEditor8";
this.ultraComboEditor8.Size = new System.Drawing.Size(144, 21);
this.ultraComboEditor8.TabIndex = 6;
this.ultraComboEditor8.Text = "ultraComboEditor8";
// typedDataSet1
this.typedDataSet1.DataSetName = "NewDataSet";
// ultraComboEditor5
this.ultraComboEditor5.DataMember = "TableOne";
this.ultraComboEditor5.DataSource = this.typedDataSet1;
this.ultraComboEditor5.DisplayMember = "one";
this.ultraComboEditor5.Location = new System.Drawing.Point(381, 12);
this.ultraComboEditor5.Name = "ultraComboEditor5";
this.ultraComboEditor5.Size = new System.Drawing.Size(144, 21);
this.ultraComboEditor5.TabIndex = 11;
this.ultraComboEditor5.Text = "ultraComboEditor5";
// ultraComboEditor6
this.ultraComboEditor6.DataMember = "TableTwo";
this.ultraComboEditor6.DataSource = this.typedDataSet1;
this.ultraComboEditor6.DisplayMember = "one";
this.ultraComboEditor6.Location = new System.Drawing.Point(381, 39);
this.ultraComboEditor6.Name = "ultraComboEditor6";
this.ultraComboEditor6.Size = new System.Drawing.Size(144, 21);
this.ultraComboEditor6.TabIndex = 12;
this.ultraComboEditor6.Text = "ultraComboEditor6";
// ultraComboEditor7
this.ultraComboEditor7.DataMember = "TableThree";
this.ultraComboEditor7.DataSource = this.typedDataSet1;
this.ultraComboEditor7.DisplayMember = "one";
this.ultraComboEditor7.Location = new System.Drawing.Point(381, 66);
this.ultraComboEditor7.Name = "ultraComboEditor7";
this.ultraComboEditor7.Size = new System.Drawing.Size(144, 21);
this.ultraComboEditor7.TabIndex = 13;
this.ultraComboEditor7.Text = "ultraComboEditor7";
// Form4
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(636, 206);
this.Controls.Add(this.ultraComboEditor7);
this.Controls.Add(this.ultraComboEditor6);
this.Controls.Add(this.ultraComboEditor5);
this.Controls.Add(this.button3);
this.Controls.Add(this.ultraComboEditor8);
this.Controls.Add(this.button1);
this.Controls.Add(this.ultraComboEditor4);
this.Controls.Add(this.ultraComboEditor3);
this.Controls.Add(this.ultraComboEditor2);
this.Controls.Add(this.ultraComboEditor1);
this.Name = "Form4";
this.Text = "Form4";
((System.ComponentModel.ISupportInitialize)(this.ultraComboEditor1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ultraComboEditor2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ultraComboEditor3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ultraComboEditor4)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ultraComboEditor8)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.typedDataSet1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ultraComboEditor5)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ultraComboEditor6)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ultraComboEditor7)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
#endregion
private Infragistics.Win.UltraWinEditors.UltraComboEditor ultraComboEditor1;
private Infragistics.Win.UltraWinEditors.UltraComboEditor ultraComboEditor2;
private Infragistics.Win.UltraWinEditors.UltraComboEditor ultraComboEditor3;
private Infragistics.Win.UltraWinEditors.UltraComboEditor ultraComboEditor4;
private System.Windows.Forms.Button button1;
private Infragistics.Win.UltraWinEditors.UltraComboEditor ultraComboEditor8;
private System.Windows.Forms.Button button3;
private TypedDataSet typedDataSet1;
private Infragistics.Win.UltraWinEditors.UltraComboEditor ultraComboEditor5;
private Infragistics.Win.UltraWinEditors.UltraComboEditor ultraComboEditor6;
private Infragistics.Win.UltraWinEditors.UltraComboEditor ultraComboEditor7;
I tried putting your sample code into a new project, but it's extremely difficult to do, since this doesn't include references, the form code is missing, and there are no includes.
Could you post a small sample project that I can run to see the problem occur?
My apologies Mike, my code had a few errors in it that I overlooked.
The non .Net references you'll have to add are:
Infragistics2.Shared.v8.3, Infragistics2.Win.UltraWinEditors.v8.3, Infragistics2.Win.v8.3
The new code is:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Diagnostics;
using System.Data;
using System.Text;
using Infragistics.Win.UltraWinEditors;
namespace Garbage
this.typedDataSet1 = new TypedDataSet();
This is still a real pain to set up in a project, if for no other reason than that the forums mess up the formatting of the code.
Couldn't you just attach your sample here?
Hi,
If this turns out to be an issue with the BindingManager in DotNet, then there might not be anything we can do about it.
It looks to me like someone misunderstood the issue, though.
They seem to be saying that the slow-down is caused by the control responding to notifications from the BindingManager each time a new row is added.This is a perfectly valid concern, and it's probably more efficient to populate your data source before you bind to a control, as a general rule.
But in the sample you posted here, the combo is bound to the data source in both cases before you add the rows to it. So responding to BindingManager notifications does not explain why it works in one case and not in the other.
cstodgell said:To say I was shocked is a complete understatement. What is the point of the designer then? Why have comboBox binding available at all if I have to unbind before the call to the backend and then re-bind again after?
Generally speaking, using the design is more convenient than writing code. But it's very often not the most efficient way to do things. In fact, DataBinding in general is a convenience. It's usually not the most efficient way to populate a control with data. But it makes up for being slightly less efficient by being very easy to do.
cstodgell said:Do you know how we find out if the licenese we have entitles us to upgrades??? I was speaking with the developer who purchase the licensed and he does not know.
I don't know about that, you'd have to contact sales or developer support. Service releases are always free, but upgrades to new volume releases require a subscription, I think.
Interesting. You may find it interesting the .NET controls exhibit similar behavior.
When I brought this to the MSDN forums the moderators told me this is expected behavior. The solution, they said, was to bind after your data call.
To say I was shocked is a complete understatement. What is the point of the designer then? Why have comboBox binding available at all if I have to unbind before the call to the backend and then re-bind again after?
I am still bewildered that this is expected AND accepted by the community. If you interested you can find the thread here: http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/179a7d00-fb15-44d7-bd3d-a8b940d4de8c
Do you know how we find out if the licenese we have entitles us to upgrades??? I was speaking with the developer who purchase the licensed and he does not know.
Anyways, thank you for looking into it. I'm interested to here the response.
Okay, now that I have the sample, I ran it and I see the same behavior you describe. Right off the top of my head, I cannot explain this behavior. It would seem that both buttons are doing essentially the same thing here, so I can't see any reason why one should take so much longer than the other. It's quite a puzzle.
I'm going to forward this thread over to Infragistics Developer Support so that thy can create a case for you and write this up for developer review.
One thing to note is that the version you are using is no longer supported. So I updated the project to the latest supported version, which is v9.2. But that didn't make any difference, I still get the same problem. But just so you know, if this issue requires a fix in the controls, it will only be fixed in the supported versions. But we will have to look into the issue and see if we can find a workaround.
Sorry, I wasn't aware that we could upload files here... I would have done that initially if I knew lol. (I'm use to dealing with MSDN forums).
Thanks again for your patience.