C#: Advanced Guide to Learn C# Programming Effectively by Smith Benjamin
Author:Smith, Benjamin [Smith, Benjamin]
Language: eng
Format: epub
Published: 2021-01-03T00:00:00+00:00
The four types of buttons each have their own functionality and behavior which can further be implemented in different ways. The âall rightâ button represented as >> is set to transfer all the elements contained in the left list to the right list whenever it is pressed. On the other hand, the âall leftâ button << does the exact opposite, that is moves the elements from the right to the left list. If it is required that only the selected elements are to be transferred, then the ârightâ button > is used to transfer them from left to the right list while the âleftâ button < does so from right to left.
The ListBox is composed of items or elements which are defined as the nested type i.e., ObjectCollection. The ListBox controls responsible for moving the elements around are handled by the method shown below.
1: private void SourceToTarget(ListBox.ObjectCollection source,
2: ListBox.ObjectCollection target)
3: {
4: target.AddRange(source);
5: source.Clear(); 6: }
7:
8: private void MoveAllLeft()
9: {
10: SourceToTarget(listBoxRight.Items, listBoxLeft.Items);
11: }
12:
13: private void MoveAllRight()
14: {
15: SourceToTarget(listBoxLeft.Items, listBoxRight.Items);
16: }
17:
18: private void SourceToTarget(ListBox.SelectedObjectCollection
19: source, ListBox.ObjectCollection target)
20: {
21: IEnumerator e = source.GetEnumerator();
22: while(e.MoveNext())
23: {
24: target.Add(e.Current);
25: }
26: }
27:
28: private void RemoveSelected(ListBox listBox)
29: {
30: for( int i=listBox.Items.Count - 1; i>=0; i--)
31: if(listBox.GetSelected(i))
32: listBox.Items.RemoveAt(i);
33: }
34:
35: private void MoveLeft()
36: {
37: SourceToTarget(listBoxRight.SelectedItems,
38: listBoxLeft.Items);
39: RemoveSelected(listBoxRight);
40: }
41:
42: private void MoveRight()
43: {
44: SourceToTarget(listBoxLeft.SelectedItems,
45: listBoxRight.Items);
46: RemoveSelected(listBoxLeft);
47: }
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Ada | Ajax |
Assembly Language Programming | Borland Delphi |
C & C++ | C# |
CSS | Compiler Design |
Compilers | DHTML |
Debugging | Delphi |
Fortran | Java |
Lisp | Perl |
Prolog | Python |
RPG | Ruby |
Swift | Visual Basic |
XHTML | XML |
XSL |
Hello! Python by Anthony Briggs(9904)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9785)
The Mikado Method by Ola Ellnestam Daniel Brolund(9769)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8282)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7771)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7756)
Grails in Action by Glen Smith Peter Ledbrook(7686)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7550)
Windows APT Warfare by Sheng-Hao Ma(6773)
Layered Design for Ruby on Rails Applications by Vladimir Dementyev(6499)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6399)
Blueprints Visual Scripting for Unreal Engine 5 - Third Edition by Marcos Romero & Brenden Sewell(6367)
Kotlin in Action by Dmitry Jemerov(5048)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(4313)
Functional Programming in JavaScript by Mantyla Dan(4037)
Solidity Programming Essentials by Ritesh Modi(3972)
WordPress Plugin Development Cookbook by Yannick Lefebvre(3755)
Unity 3D Game Development by Anthony Davis & Travis Baptiste & Russell Craig & Ryan Stunkel(3699)
The Ultimate iOS Interview Playbook by Avi Tsadok(3675)
