Click here to Skip to main content
15,886,689 members
Articles / Programming Languages / Visual Basic

YCC List Control 1.0

Rate me:
Please Sign up or sign in to vote.
3.63/5 (6 votes)
3 Mar 2009GPL34 min read 30.9K   222   11   1
YCC List Control is a generic utility Microsoft .NET control that handles many of the common operations associated with text lists

Introduction

YCC List Control is an open source user control created in Microsoft Visual Basic .NET 2008 which handles many of the common tasks associated with a list of data. YCC List Control is a graphical interface to open, save, and edit data which is then displayed in a standard ListBox control. Additionally, the programmer is able to programmatically edit data, import data, and change various aspects of the ListBox such as the currently highlighted entry.

Features

  • Change the text and color of the GroupBox that contains the ListBox
  • Increment and decrement the selected index
  • Graphically open, append, and save a list
  • Graphically add or remove an item from the list
  • Programmatically get, set, or delete the currently selected item
  • Programmatically replace, add, or delete any item based on item text
  • Import a data set (array of values) into the ListBox programmatically
  • Various events showing what operations have been completed

Rational and Background

On more than one occasion, I have found myself needing a general use control that imported and manipulated a list of data. It seems that most of my projects involve a list of names, passwords, or accounts so after about the third time of recreating the same functionality in individual programs, I decided to create a general utility control that could be used for all of these projects and even future projects. Since its initial creation, YCC List Control has had many features added and tweaked but the basic principal remained the same.

YCC List Control is a ListBox and ToolStrip inside a GroupBox. The ListBox is standard but the ToolStrip has been modified to remove the line that usually separates itself from the main content. Within the ToolStrip, there are buttons to add a list, append to a list (keep what is there and add to it), save what is currently in the list, add a value to the list, and remove the selected value. With each operation, a line count is kept and displayed in the GroupBox text. All of these operations are meant for the end-user to load their lists into the parent program and then have the data accessible to other parts of the parent program.

Once the data is in the parent program, the programmer must have a way to retrieve and use the data. A common operation is to get the currently selected item and then increment the selected index for the next get operation. This can be accomplished with the following two lines:

VB.NET
txtGetCurret.Text = YLCMain.GetSelectedValue

YLCMain.IncrementSelectedIndex()

There are also inverses to the above operations and a programmer can also set the current item value or decrement the selected index.

Another common operation is to remove a particular value from the list once it is found that the item in question is no longer valid. This can be accomplished by the following.

VB.NET
YLCMain.Delete(txtDeleteValue.Text)

Other operations such as deleting the current item, replacing an item with another item, and adding an item can be performed programmatically. Another feature of YCC List Control is the data is also kept in a string array separate from the ListBox. This allows the programmer to retrieve and import the data as a string array if it better fits the programming model.

The most well known use of the YCC List Control is in YCC Yahoo! Bot Maker which uses the control in the proxy list. Here the YCC List Control gets the selected proxy from the list and then increments the selected index for the next proxy. If an error occurs with the proxy, that proxy is removed from the list.

Using the Code

YCC List Control is a standard user control and can be added to any project programmatically or through the Visual Studio Designer. When in design mode, make sure the Toolbox is showing by selecting View and then Toolbox (crtl + alt + x). Right click on the Toolbox and select Choose Items… A Choose Toolbox Items dialogue pops up and under the .NET Framework Components tab, click Browse. Select the location of YCC List Control/bin/Debug/ YCC List Control.dll and then click Open. You will notice a new item in the Toolbox named YCC List Control and you can now use it like any other form control.

Requirements

Homepage

YCC List Control and many other useful programs are housed at Yahoo! Coder's Cookbook (http://ycoderscookbook.com/). Also at Yahoo! Coder's Cookbook is a full tutorial section explaining much of the Yahoo! Messenger protocol, a frequently updated blog, other code samples for Yahoo! Messenger, and much more.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Yahoo! Coder's Cookbook
United States United States
I am the webmaster for the Yahoo! Coder’s Cookbook located at http://ycoderscookbook.com. At the Yahoo! Coder’s Cookbook (YCC) I have a blog (http://ycoderscookbook.com/blog/), forum (http://ycoderscookbook.com/forums/), Yahoo! Messenger protocol tutorials (http://ycoderscookbook.com/tutorials/index.html) and several programs (http://ycoderscookbook.com/code/index.html). The most notable programs are YCC Yahoo! Bot Maker (http://ycoderscookbook.com/code/YCC_Yahoo_Bot_Maker.html) which is a Yahoo! account creation tool, YCC Cam Cap (http://ycoderscookbook.com/code/YCC_Cam_Cap.html) which automatically captures Yahoo! webcam windows, and YCC Trainer (http://ycoderscookbook.com/code/YCC_Trainer.html) which is a basic primer for learning the Yahoo! Messenger protocol, YMSG. I also offer developer services (http://ycoderscookbook.com/donations/index.html) for those wishing for their very own Yahoo! tool but do not have the time or expertise.

Comments and Discussions

 
GeneralMy vote of 2 Pin
arepetti9-Mar-09 9:12
arepetti9-Mar-09 9:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.