PC Review


Reply
Thread Tools Rate Thread

data binding problem

 
 
Nikolay
Guest
Posts: n/a
 
      18th Mar 2006
Dear all,

I see a very weird behavior in my C# .NET project. When I bind my
custom DataComboBox control, all event handlers stop working! Does
anyone have any idea how to fix that?

Thanks in advance!

Best regards,
Nikolay

---

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using SySal.OperaDb;

namespace BatchLinkConfigurator
{
/// <summary>
/// Summary description for Selector.
/// </summary>
public class Selector : System.Windows.Forms.Form
{
public static void Main()
{
Selector theSelector = new Selector();
theSelector.ShowDialog();
}

private long _configId;
private class Config
{
private long _id;
public long Id
{
get{return _id;}
set{_id = value;}
}
}
private Config _config = new Config();
private OperaDbConnection _connection;

private DataComboBox.DataComboBox dataComboBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public Selector()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
OperaDbCredentials cred = OperaDbCredentials.CreateFromRecord();
_connection = cred.Connect();
_connection.Open();
dataComboBox1.Fill("SELECT ID, DESCRIPTION FROM TB_PROGRAMSETTINGS
WHERE EXECUTABLE='IntercalibrationDriver.exe'", _connection);
dataComboBox1.DataBindings.Add("SelectedValue", _config, "Id");
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dataComboBox1 = new DataComboBox.DataComboBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// dataComboBox1
//
this.dataComboBox1.Location = new System.Drawing.Point(16, 16);
this.dataComboBox1.Name = "dataComboBox1";
this.dataComboBox1.Size = new System.Drawing.Size(264, 21);
this.dataComboBox1.TabIndex = 0;
this.dataComboBox1.Text = "dataComboBox1";
//
// button1
//
this.button1.Location = new System.Drawing.Point(16, 232);
this.button1.Name = "button1";
this.button1.TabIndex = 1;
this.button1.Text = "Edit";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(200, 232);
this.button2.Name = "button2";
this.button2.TabIndex = 2;
this.button2.Text = "Cancel";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// Selector
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.dataComboBox1);
this.Name = "Selector";
this.Text = "Selector";
this.ResumeLayout(false);

}
#endregion

private void button2_Click(object sender, System.EventArgs e)
{
Close();
}

private void button1_Click(object sender, System.EventArgs e)
{
MessageBox.Show("Preved!");
//MessageBox.Show("Id = " + _config.Id);
}
}
}

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Binding Problem Gordon Padwick Microsoft C# .NET 0 6th Aug 2009 01:53 AM
100K item data binding: Is asynchronous data binding possible? R Reyes Microsoft C# .NET 14 5th Feb 2008 09:47 PM
Data binding problem Jakes Microsoft Dot NET Framework Forms 0 26th May 2006 07:36 AM
data binding problem norm Microsoft ADO .NET 1 18th Sep 2004 08:21 AM
Re: Data Binding problem ??? ajaymehra Microsoft ASP .NET 0 9th Feb 2004 06:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:16 AM.