/// <summary> /// adds item to list box /// </summary> /// <param name="obj"></param> /// <param name="text"></param> private void AddListBox(ListBox obj, string text) { if (obj.InvokeRequired) { AddListBoxCallback tcb = new AddListBoxCallback(AddListBox); this.Invoke(tcb, new Object[] { obj, text }); } else { if (obj.Items.Contains(text)) { return; } obj.BeginUpdate(); obj.Items.Add(text); obj.EndUpdate(); } }
/// <summary> /// adds item to list box /// </summary> /// <param name="obj"></param> /// <param name="text"></param> private void AddListBox(ListBox obj, string text) { if (obj.InvokeRequired) { AddListBoxCallback tcb = new AddListBoxCallback(AddListBox); this.Invoke(tcb, new Object[] { obj, text }); } else { if (obj.Items.Contains(text)) return; obj.BeginUpdate(); obj.Items.Add(text); obj.EndUpdate(); } }
private void AddListBox(ListBox lb) { if (this.InvokeRequired) { AddListBoxCallback d = new AddListBoxCallback(AddListBox); this.Invoke(d, new object[] { lb }); } else { this.Controls.Add(lb); } }