ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 26 Apr 2017 My Price 9.00

iLabs, iLab A and iLab B

Hi i saw your message i thought i would get an alert on my email i didn't thats why i missed it. 

First name: Justin

Las name: Oliver

 

 

Scenario Summary
This week we will actually do two iLabs, iLab A and iLab B. The first iLab is quite simple and
will take very little time. It illustrates the use of collections by using a VB control that already
uses collections internally (the listbox). With this iLab, we’ll quickly be able to visually observe
how a collection works to display our data.
For iLab B we will store instantiated objects directly into a List object. We’ll be creating playing
cards and randomly displaying five of them on the screen. DELIVERABLES
When the application starts, the user will be able to select the Open command from the File
menu. An OpenFileDialog control will appear and let the user select the input file. The file is
read into a string list, and each word from the file is inserted into the dictionary. The application
is now ready to let the user search for a word. The user types in a single word and clicks the Find
button to view a list of all lines from the file that contain the word Grading Rubric
The criteria used for grading your iLab are as follow iLab A Steps—Step 1: Create New Application
Create a new application named YournameProjectNameList. This application will allow you to
enter a first and last name for a person. The program will then add that person to a list on the
right-hand side of the form. A clear button will clear the ListBox and the TextBoxes. Step 2: Create Data Collection Form frmList
The form should be created as shown below. Names for the controls are suggested. Of course,
you can get creative with your layout of the interface.
Make sure that tbFirst has a TabIndex property of 0; tbLast has a TabIndex property of 1;
btnAdd, of 2; btnClear, of 3; and btnExit, of 4. Set the TabStop of the list box to false. This will
control the order that you move between controls by pressing the Tab key. The program will look like this when it runs. Notice that as each name is entered and added to the list, the names are placed in a last-namefirst, first-name-last order with a comma between the last name and first name. To do this, I
double-clicked the Add Person button to enter the code view, then I created a string named
fullname. The fullname was simply the last name, a comma with a space, and then the first name,
all concatenated. Remember that a ListBox is a control that has an internal collection object already instantiated
and added to the ListBox. This collection is referred to as Items by the ListBox. Therefore, to
add something to the ListBox, you need to call a method of its Items collection called Add.
listboxNames.Items.Add(fullname) The Add method will basically add the fullname to the collection in the ListBox. For this
particular collection, we are adding strings (that’s what a ListBox needs), but eventually we’ll
learn how to add different types of objects to collections.
After I add the full name, I then clear the TextBoxes for first name and last name, then focus on
the first name TextBox to get ready to input the next name. Step 4: Create the Clear Button Code and the Exit Button
Code
Not only does the Clear button clear and refocus the TextBoxes, but it also will clear the Items
collection within the ListBox. Find the right method for doing this. Step 5: Sort the List
By this step, you should test your program. Add some names and see how it works.
How would you sort this list of names? Look for a property of the ListBox that can accomplish
this. It really couldn’t be any easier. Step 6: Add a Delete Button
Add a Delete button named btnDelete to your form. Make sure the SelectionMode property of your ListBox is set to One. This will allow the user to
only select one name at a time for deletion.
Add the following code to the Delete button. The SelectedIndex property of the ListBox will contain a value from 0 to (n-1), where n is the
number of items in the ListBox. Anything less than 0 means that no item was selected. Notice
that the If statement merely ignores the Delete button and leaves (returns) from the method if no
person is selected.
The Remove method will simply remove the selected item from the collection, thereby removing
it from the ListBox. It would probably be a good idea to also clear the TextBoxes and return the
cursor to the First Name TextBox. Step 7: Add an ErrorProvider
You learned last week how to add an ErrorProvider to the first name and last name TextBoxes.
Make sure that only the Add button causes validation, otherwise you won’t be able to press
Delete, Clear, or Exit. Step 8: Turn It In
Take several screenshots of your program working (hit Alt+Print Screen to capture the active
window) and put them in a Word Document. I would imagine you'll need at least 10 screenshots
with a short write-up of what the screenshot is testing (such as showing how something was
deleted from the list). Zip up your entire project and submit it to the DropBox along with the
examples. iLab B Steps—Step 1: Create a New Application
Create a new application named YournameProjectCards. This application will read in an entire
deck of playing card pictures from JPEG files and build a Collection of playing card objects.
This list will be used to generate five random playing cards on the screen. Step 2: Create Display Form
Add five PictureBoxes to the display form and two buttons. I named the PictureBoxes pic1
through pic5. The two buttons are btnPick5 and btnExit. The form is named frmCards. I also
added a label at the bottom that looks like a TextBox named lblValue. This lblValue has its
backcolor set to a yellow, its autosize set to false, and its BorderStyle set to fixed3D. Another
label is used to explain it is the Card Value. We’ll be using it to total up our cards. Step 3: Add the Cards to the Project
The cards are found in a zipped file in document sharing entitled Cards.zip. This file must be
placed in the project folder in a subdirectory that shares the name of the project. The VB project
files will also be there, including your form, which should be titled frmCards.vb. There will be
quite a few pictures in the zipped file, including the 52 cards, a joker, and the backs of the cards.
Notice the naming convention used. The CardBack is then loaded from disk as well.
All of the PictureBoxes are then added to the tablePictures list, and a For Each loop is used to
load the CardBack into each of the picture boxes on the form (which are all stored in
tablePictures). If you are unfamiliar with the For Each loop, look it up! It's a very handy way to
move through collections.

Attachments:

Answers

(11)
Status NEW Posted 26 Apr 2017 08:04 AM My Price 9.00

-----------

Not Rated(0)