コード例 #1
0
ファイル: ComboBoxWithId.cs プロジェクト: jfarre20/Ubiquitous
        public void SetDataSource(BindingSource source, string displayMember = "", string valueMember = "", bool dropdown = false)
        {
            if (this.InvokeRequired)
            {
                SetComboDataSource dlgt = new SetComboDataSource(SetDataSource);
                Invoke(dlgt, new object[] { source,displayMember,ValueMember, dropdown });
            }
            else
            {
                try
                {
                    var text = this.Text;
                    if (source == null)
                        this.DataSource = null;
                    else
                        this.DataSource = source.DataSource;

                    if( !String.IsNullOrEmpty( displayMember ))
                        this.DisplayMember = displayMember;

                    if( !String.IsNullOrEmpty( valueMember))
                        this.ValueMember = ValueMember;

                    //this.SelectedItem = null;
                    
                    //if (this.Text != text)
                     //   this.Text = text;

                    //this.SelectionStart = this.Text.Length;
                    //this.DroppedDown = dropdown;
                }
                catch { }
            }
        }
コード例 #2
0
        public void SetDataSource(BindingSource source, string displayMember = "", string valueMember = "")
        {
            if (this.InvokeRequired)
            {
                SetComboDataSource dlgt = new SetComboDataSource(SetDataSource);
                Invoke(dlgt, new object[] { source,displayMember,ValueMember });
            }
            else
            {
                if (source == null)
                    this.DataSource = null;
                else
                    this.DataSource = source.DataSource;

                this.DisplayMember = displayMember;
                this.ValueMember = ValueMember;

            }
        }
コード例 #3
0
ファイル: ComboBoxWithId.cs プロジェクト: jfarre20/Ubiquitous
        public void SetDataSource(BindingSource source, string displayMember = "", string valueMember = "", bool dropdown = false)
        {
            if (this.InvokeRequired)
            {
                SetComboDataSource dlgt = new SetComboDataSource(SetDataSource);
                Invoke(dlgt, new object[] { source, displayMember, ValueMember, dropdown });
            }
            else
            {
                try
                {
                    var text = this.Text;
                    if (source == null)
                    {
                        this.DataSource = null;
                    }
                    else
                    {
                        this.DataSource = source.DataSource;
                    }

                    if (!String.IsNullOrEmpty(displayMember))
                    {
                        this.DisplayMember = displayMember;
                    }

                    if (!String.IsNullOrEmpty(valueMember))
                    {
                        this.ValueMember = ValueMember;
                    }

                    //this.SelectedItem = null;

                    //if (this.Text != text)
                    //   this.Text = text;

                    //this.SelectionStart = this.Text.Length;
                    //this.DroppedDown = dropdown;
                }
                catch { }
            }
        }