tags:

views:

126

answers:

1

I had a project using C#(visual studio 2008) and sql server 2000.I installed this projects setup at three computer. İt works in two of them(xp sp3) rightly but doesnt work other(xp ultimate). İt give errors when just one form opening :"An item with the same key has already been added" How can I fix this problem??

source code:

    DBClass db = new DBClass();
    private void FrmGiris_Load(object sender, EventArgs e)
    {           
        string sorgu = "select top 50 * from IsTakipDetay where Asama='Yapılacak'";          
        DataTable data = db.DBSelect(sorgu);

        if (schedulerStorage1.Appointments.Count > 0)
            schedulerStorage1.Appointments.Clear();

        for (int i = 0; i < data.Rows.Count; i++)
        {
            DevExpress.XtraScheduler.Appointment app = new DevExpress.XtraScheduler.Appointment();
            app.Start = Convert.ToDateTime(data.Rows[i]["Saat"]);
            app.End = Convert.ToDateTime(data.Rows[i]["Saat"]);
            app.Subject = data.Rows[i]["IsAdi"].ToString() + "-" + data.Rows[i]["DetayAdi"].ToString();

            DataTable dt = db.DBSelect("select MusteriAdi,Adres from IsTakip where Id=" + Convert.ToInt32(data.Rows[i]["IsId"]));
            if (dt.Rows.Count > 0)
            {
                app.Location = dt.Rows[0]["Adres"].ToString();
                app.Description = "Müşteri Adı: " + dt.Rows[0]["MusteriAdi"].ToString() + " / Personel Adı:" + data.Rows[i]["PersonelAdi"].ToString();
            }
            schedulerStorage1.Appointments.Add(app);
        }
    }

designer code:

 #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.components = new System.ComponentModel.Container();
        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmAjanda));
        DevExpress.XtraScheduler.TimeRuler timeRuler1 = new DevExpress.XtraScheduler.TimeRuler();
        DevExpress.XtraScheduler.TimeRuler timeRuler2 = new DevExpress.XtraScheduler.TimeRuler();
        this.schedulerStorage1 = new DevExpress.XtraScheduler.SchedulerStorage(this.components);
        this.ısTakipDetayBindingSource = new System.Windows.Forms.BindingSource(this.components);
        this.dSet = new Dogalgaz.dSet();
        this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
        this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
        this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
        this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
        this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
        this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
        this.splitContainerControl1 = new DevExpress.XtraEditors.SplitContainerControl();
        this.navBarControl1 = new DevExpress.XtraNavBar.NavBarControl();
        this.navBarGroup1 = new DevExpress.XtraNavBar.NavBarGroup();
        this.itemGunluk = new DevExpress.XtraNavBar.NavBarItem();
        this.itemHafta = new DevExpress.XtraNavBar.NavBarItem();
        this.itemAylik = new DevExpress.XtraNavBar.NavBarItem();
        this.itemCizelge = new DevExpress.XtraNavBar.NavBarItem();
        this.navBarGroupControlContainer1 = new DevExpress.XtraNavBar.NavBarGroupControlContainer();
        this.groupBox1 = new System.Windows.Forms.GroupBox();
        this.radioIs = new System.Windows.Forms.RadioButton();
        this.radioPersonel = new System.Windows.Forms.RadioButton();
        this.radioTum = new System.Windows.Forms.RadioButton();
        this.comboKriter = new DevExpress.XtraEditors.ComboBoxEdit();
        this.labelKriter = new System.Windows.Forms.Label();
        this.navBarGroupControlContainer2 = new DevExpress.XtraNavBar.NavBarGroupControlContainer();
        this.dateNavigator1 = new DevExpress.XtraScheduler.DateNavigator();
        this.schedulerControl1 = new DevExpress.XtraScheduler.SchedulerControl();
        this.navBarGroup3 = new DevExpress.XtraNavBar.NavBarGroup();
        this.navBarItem2 = new DevExpress.XtraNavBar.NavBarItem();
        this.navBarItem3 = new DevExpress.XtraNavBar.NavBarItem();
        this.navBarItem1 = new DevExpress.XtraNavBar.NavBarItem();
        this.navBarGroup2 = new DevExpress.XtraNavBar.NavBarGroup();
        this.itemYazdirPencer = new DevExpress.XtraNavBar.NavBarItem();
        this.itemPrintPreview = new DevExpress.XtraNavBar.NavBarItem();
        this.itemPrint = new DevExpress.XtraNavBar.NavBarItem();
        this.navBarGroup4 = new DevExpress.XtraNavBar.NavBarGroup();
        ((System.ComponentModel.ISupportInitialize)(this.schedulerStorage1)).BeginInit();
        ((System.ComponentModel.ISupportInitialize)(this.ısTakipDetayBindingSource)).BeginInit();
        ((System.ComponentModel.ISupportInitialize)(this.dSet)).BeginInit();
        ((System.ComponentModel.ISupportInitialize)(this.splitContainerControl1)).BeginInit();
        this.splitContainerControl1.SuspendLayout();
        ((System.ComponentModel.ISupportInitialize)(this.navBarControl1)).BeginInit();
        this.navBarControl1.SuspendLayout();
        this.navBarGroupControlContainer1.SuspendLayout();
        this.groupBox1.SuspendLayout();
        ((System.ComponentModel.ISupportInitialize)(this.comboKriter.Properties)).BeginInit();
        this.navBarGroupControlContainer2.SuspendLayout();
        ((System.ComponentModel.ISupportInitialize)(this.dateNavigator1)).BeginInit();
        ((System.ComponentModel.ISupportInitialize)(this.schedulerControl1)).BeginInit();
        this.SuspendLayout();
        // Other controls codes//////////////////////
         //
        // FrmAjanda
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(974, 562);
        this.Controls.Add(this.splitContainerControl1);
        this.Name = "FrmAjanda";
        this.Text = "DOĞALGAZ TAKİP - AJANDA";
        this.Load += new System.EventHandler(this.FrmGiris_Load);
        ((System.ComponentModel.ISupportInitialize)(this.schedulerStorage1)).EndInit();
        ((System.ComponentModel.ISupportInitialize)(this.ısTakipDetayBindingSource)).EndInit();
        ((System.ComponentModel.ISupportInitialize)(this.dSet)).EndInit();
        ((System.ComponentModel.ISupportInitialize)(this.splitContainerControl1)).EndInit();
        this.splitContainerControl1.ResumeLayout(false);
        ((System.ComponentModel.ISupportInitialize)(this.navBarControl1)).EndInit();
        this.navBarControl1.ResumeLayout(false);
        this.navBarGroupControlContainer1.ResumeLayout(false);
        this.groupBox1.ResumeLayout(false);
        this.groupBox1.PerformLayout();
        ((System.ComponentModel.ISupportInitialize)(this.comboKriter.Properties)).EndInit();
        this.navBarGroupControlContainer2.ResumeLayout(false);
        ((System.ComponentModel.ISupportInitialize)(this.dateNavigator1)).EndInit();
        ((System.ComponentModel.ISupportInitialize)(this.schedulerControl1)).EndInit();
        this.ResumeLayout(false);

    }

    #endregion

    private System.Windows.Forms.BindingSource ısTakipDetayBindingSource;
    private dSet dSet;
    private System.Data.SqlClient.SqlConnection sqlConnection1;
    private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
    private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
    private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
    private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
    private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
    private DevExpress.XtraEditors.SplitContainerControl splitContainerControl1;
    private DevExpress.XtraNavBar.NavBarControl navBarControl1;
    private DevExpress.XtraNavBar.NavBarGroup navBarGroup1;
    private DevExpress.XtraNavBar.NavBarItem itemGunluk;
    private DevExpress.XtraNavBar.NavBarItem itemHafta;
    private DevExpress.XtraNavBar.NavBarItem itemAylik;
    private DevExpress.XtraNavBar.NavBarItem itemCizelge;
    private DevExpress.XtraNavBar.NavBarGroup navBarGroup2;
    private DevExpress.XtraNavBar.NavBarItem itemYazdirPencer;
    private DevExpress.XtraNavBar.NavBarItem itemPrintPreview;
    private DevExpress.XtraNavBar.NavBarItem itemPrint;
    private DevExpress.XtraScheduler.SchedulerControl schedulerControl1;
    public DevExpress.XtraScheduler.SchedulerStorage schedulerStorage1;
    private DevExpress.XtraNavBar.NavBarItem navBarItem1;
    private DevExpress.XtraNavBar.NavBarGroup navBarGroup3;
    private DevExpress.XtraNavBar.NavBarItem navBarItem3;
    private DevExpress.XtraNavBar.NavBarItem navBarItem2;
    private DevExpress.XtraNavBar.NavBarGroupControlContainer navBarGroupControlContainer1;
    private System.Windows.Forms.GroupBox groupBox1;
    private DevExpress.XtraEditors.ComboBoxEdit comboKriter;
    private System.Windows.Forms.Label labelKriter;
    private System.Windows.Forms.RadioButton radioIs;
    private System.Windows.Forms.RadioButton radioPersonel;
    private System.Windows.Forms.RadioButton radioTum;
    private DevExpress.XtraNavBar.NavBarGroupControlContainer navBarGroupControlContainer2;
    private DevExpress.XtraScheduler.DateNavigator dateNavigator1;
    private DevExpress.XtraNavBar.NavBarGroup navBarGroup4;
}

}

But the problem is that, it worked on two computer(xp sp3) but didnt the third(xp ultimate) Why?

And just this form gives error The other forms work correctly.

can it be because of operating system?

A: 

It seems that one of the controls on that failing form adds objects to a list/dictionary every time the form is loaded. The designer than adds a second line to the designer file and next time the form loads, it fails with that error.

So please post the designer part of the form.

BeowulfOF
thanks.. but i didnt understand that why it works on acomputer but didnt works on the other?
akaradogan
does exactly this one document open up in the other two computers?
BeowulfOF
yes it is opened exactly
akaradogan
akaradogan, please edit your question like Lasse V. Karlsen stated. Second, please put the designercode of the failing form into your question, that we can find out what is wrong. If we know what, we can find out why, not the otherway round.
BeowulfOF
ı edited my question an put the designer code Help me please
akaradogan