Tuesday 1 September 2015

BMIS 208 VB PROGRAMMING ASSIGNMENT 7

BMIS 208 VB PROGRAMMING ASSIGNMENT 7


Online Homework Solutions aims to provide quality study notes and tutorials to the students of BMIS 208 VB PROGRAMMING ASSIGNMENT 7 in order to ace their studies.


BMIS 208 VB PROGRAMMING ASSIGNMENT 7 INSTRUCTIONS

Adapted from Introduction to Programming Using Visual Basic 2012, 9/E, David I. Schneider.


Create and Maintain Telephone Directories


Write a Visual Basic program to create and maintain telephone directories. Each telephone directory should be contained in a separate text file. In addition, a file named Directories.txt should hold the names of the telephone directories. At any time, names of all the telephone directories should be displayed in a list box. After a telephone directory is selected, it becomes the current phone directory. The following buttons should be available.

a. Create a new telephone directory. (The filename should be provided by an input dialog box.) A new text file should be created for the directory, and the name of the new directory should be added to the Directories.txt file. The Phone Directories listbox should immediately be refreshed to reflect the new directory, and the new directory should be automatically seleted from the listbox. Note that this selection should trigger the procedure that sets the current directory and updates the contents of the current directory textbox. Also note that the list of directories is displayed in ascending order in the listbox.

b. Add a listing (as given in textboxes) to the end of the current phone directory. This action should update the text file containing the listings of the current directory and refresh the grid to display the newly added listing.

c. Delete a name (as specified in the “Name” text box) from the current phone directory. This action should update the text file containing the listings of the current directory. As is good software development practice, you should prompt the user with a messagebox that allows him to confirm the deletion before any permanent action is taken to delete the entry from the file. The grid should also refresh to show the removal of the listing.

d. Display the names and phone numbers in the current phone directory. (Note that the listings are displayed in ascending order in the table.)


Design your form as depicted in the diagram below.


Helpful hints:

1. The text files needed for this assignment should be placed in the bin\debug folder of the project.

2. When the form opens, populate the directories listbox with the names of the directories.

3. Use an array and IO.ReadAllLines to populate the array with the list of directories.

4. Use the StreamWriter in conjunction with IO.File.AppendText and IO.File.CreateText to append new directories and create new text files. (Note: You will need to use the WriteLine method to write the name of the new file to Directories.txt.)

5. When the user clicks the Create a New Phone Directory button, prompt him to enter the name using an InputBox. If the user fails to enter a name, display a message to him (i.e. “Invalid directory name”), and do not proceed to create a new directory. If the operation is successful, make the new directory the current directory.

6. Before adding a new directory, make sure it doesn’t already exist. You may find it helpful to use Array.IndexOf in your check.

7. To display the contents of the directories file, use a LINQ query. Loop over all of the items in the query using a For each statement to populate the listbox.

8. Before displaying the contents of the directories file, make sure the file exists first. You will need to use the IO.File.Exists method in your check.

9. Use good programming practices by clearing the listbox and table before refreshing them when a change is made that affects their contents.

10. Remember to close the files after accessing them.

11. To remove a listing from a directory, you may find this code helpful as it selects only those records in the file that are not the one the user wants to remove. The code should then write the results of this query back to the file:

Dim query = From line In IO.File.ReadAllLines(fileName)

Let name = line.Split(“,”c)(0)

Let phoneNum = line.Split(“,”c)(1)

Where name <> txtName.Text

Select name & “,” & phoneNum

IO.File.WriteAllLines(fileName, query.ToArray)


12. Use a DataViewGrid control to display the contents of a specific directory.

13. Include appropriate error checking (i.e. check for blank names, phone numbers, etc.)

14. Use appropriate naming conventions for all controls.


Homework BMIS 208 VB PROGRAMMING ASSIGNMENT 7

BMIS 208 VB PROGRAMMING ASSIGNMENT 7


BMIS 208 VB PROGRAMMING ASSIGNMENT 7


http://www.onlinehomeworksolutions.com/


AC · ACC · ACCT · ACCTG · ACG · ACNT · ACT · AED · AET · AFT · AH · AI · AIMS · AJS · AL · ALG · AMBA · ANT · AR · ART · ARTS · AST · BA · BAI · BAM · BAT · BBA · BBC · BBUS · BCJ · BCOM · BE · BEH · BEM · BEST · BHA · BI · BIMS · BIO · BIOL · BIOS · BIS · BITO · BIZ · BIZNZ · BM · BMDS · BMGT · BMIS · BNSN · BOB · BOLT · BOOK · BORE · BOS · BR · BRO · BSA · BSHS · BT · BTM · BU · BUA · BUL · BURN · BUS · BUSI · BUSN · BUSS · BYP · BZ · CBM · CC · CCIS · CCJ · CE · CEIS · CFIN · CGD · CGS · CIS · CJ · CJA · CJHS · CJS · CJUS · CMC · CMGT · CMIS · CMIT · CO · COIN · COIT · COL · COLA · COLL · COM · COMM · COMP · COSC · COUN · CPMGT · CQ · CRI · CRMJ · CS · CSC · CSCI · CSE · CSI · CSS · CST · CUL · CX · DAAC · DB · DBM · DMB · DMDK · DOCX · DRAW · DRG · EARN · EBT · EBUS · EC · ECC · ECCO · ECE · ECET · ECN · ECO · ECOL · ECOM · ECON · ECT · EDU · EE · EED · EEK · EEL · EG · EGM · EGT · EH · ELL · EM · EMG · EN · END · ENG · ENGL · ENGR · ENV · ENVV · ESE · ETH · ETHC · EX · EXP · FEN · FF · FI · FILE · FIN · FINA · FINC · FINGM · FIRM · FIS · FN · FNC · FNCE · FNS · FNT · FP · GB · GBA · GBM · GE · GEN · GEO · GEOG · GET · GEW · GLG · GM · GMC · GOAL · GOT · GOV · GOVT · GP · GRID · GRM · GRT · GS · GSCM · GTT · GURU · HA · HALL · HCI · HCIS · HCP · HCR · HCS · HEA · HHS · HI · HIS · HIST · HIUS · HLT · HLTH · HM · HMCO · HMT · HPE · HR · HRDV · HRM · HS · HSA · HSC · HSCO · HSM · HSS · HTM · HTML · HU · HUIS · HUM · HUMN · HW · HWY · HY · ICS · IFRS · IM · IME · INB · INF · INFA · IS · ISA · ISCOM · ISM · ISMN · ISSC · ISSN · IT · ITB · ITC · ITCO · ITEC · ITEM · ITM · IWT · JESS · JET · JFT · JGT · JIS · JKQ · JUIS · JUST · JWI · JWM · JWMI · KIO · KO · LAS · LASA · LAW · LAWS · LCC · LDR · LEG · LEST · LIB · LIES · LIKE · LIT · LLC · LO · LOG · LP · LSS · LTC · MA · MAN · MAT · MATH · MATT · MB · MBA · MBAA · MC · MCJ · MEC · MFW · MG · MGMT · MGT · MHA · MILL · MIS · MISC · MIST · MKT · MKTG · ML · MM · MMHA · MN · MNSO · MOON · MPM · MT · MTH · MTK · NET · NETW · NH · NIBR · NIT · NR · NRS · NSG · NTC · NU · NUR · NURS · NV · OBEO · OI · OM · OMM · ORG · OWNS · PA · PAR · PARI · PBO · PCN · PDF · PEP · PG · PGBM · PH · PHI · PHIL · PHL · PHSC · PHY · PHYS · PL · PLY · PM · PPA · PR · PRES · PRG · PROJ · PRS · PRT · PS · PSY · PSYC · PSYT · PXT · QAT · QGT · QLT · QNT · QRB · QS · QSO · QTR · QUANT · RACE · RDG · RE · REL · RENT · RES · RICK · RM · ROLE · ROOM · RTT · SA · SAT · SBE · SC · SCI · SCIE · SCIN · SCM · SE · SEC · SEI · SHS · SLP · SNAG · SO · SOC · SOCS · SOEN · SRM · SRT · SS · STA · STAR · STAT · STR · TCO · TCOS · TEC · THEM · TIER · TLB · TLMT · TM · TO · TRP · TURN · TY · UC · UCC · UGB · UNVI · USTIC · VCT · VIEW · VTC · WAYS · WEB · WEE · WEEL · WRTG · WW · XACC · XBCOM · XBIS · XCOM · XECO · XMGT · ZNSO



BMIS 208 VB PROGRAMMING ASSIGNMENT 7

No comments:

Post a Comment