I have the code for this project, but how do I add this user-defined exception that I want?

For a final VB.NET project, I have to write a project that ascends and descends a word or number chosen by the user. 
This is what I want to do:
I want to add a user defined error that will stop the program and tell the user to input a value into the program if they did not. I do not know how to do this. I think I would use a Null Reference exception. 
Here is the code for the project:
Module Module1 'VB.NET Final Project 12/30/14 . Option 3: Write a program to run two separate threads printing numbers or words (It can do both) in ascending and descending orders. The words have to be given by the user.
    Dim Ascending As System.Threading.Thread = New Threading.Thread(AddressOf PrintAscend) 'Two threads are declared,
    Dim Descending As System.Threading.Thread = New Threading.Thread(AddressOf PrintDescend) 'ascending and descending 
    Sub Main()
        Console.WriteLine("VB.NET Final Project 12/30/14 . Option 3: Write a program to run two separate threads printing numbers or words (It can do both) in ascending and descending orders. The words have to be given by the user.")
        Ascending.Start() 'starts first thread
    End Sub
    Sub PrintAscend()
        Console.WriteLine("Please type in a word to print in ascending order.") 'the program asks for users to input a word
        Dim input As String 'as a string
        input = Console.ReadLine()
        For i As Integer = 0 To input.Length - 1
            Console.WriteLine(input.Chars(i)) 'prints the letters of the word in ascending order 
        Next
        If Ascending.ThreadState = Threading.ThreadState.Running Then Descending.Start() 'starts second thread
    End Sub
    Sub PrintDescend()
        Console.WriteLine("Please type in a word or number to print in descending order.")
        Dim input As String
        input = Console.ReadLine() 'user inputs the word that he wants
        For i As Integer = input.Length - 1 To 0 Step -1
            Console.WriteLine(input.Chars(i)) 'prints the letters of the word in descending order 
        Next
        Console.WriteLine("Please press enter key to close the program, and thanks for your time.")
        Console.ReadKey()
    End Sub
End Module

Dejavu again?
Is your teacher instructing you to use a User Defined
error or do you just want to accept the user input, check it, give a message, and repeat?
It seems to me you are missing the basic program loop? This example checks the user input and then performs an action, then repeats. If the user enters Quit execution stops. Is that what you want to do?
Module Module1
Sub Main()
Console.Title = "Make a Decision"
Dim theline As String = ""
Do While theline <> "Quit"
Console.WriteLine(vbLf & "Enter a or b." & vbLf)
theline = Console.ReadLine()
Select Case theline
Case "a", "A"
Console.WriteLine(vbLf & ">> Result: You entered A.")
Console.WriteLine(vbLf & " ** Output Complete **" & vbLf)
Case "b", "B"
Console.WriteLine(vbLf & ">> Result: You entered B.")
Console.WriteLine(vbLf & " ** Output Complete **" & vbLf)
Case Else
Console.WriteLine(vbLf & """" & theline & """ is invalid.")
End Select
Loop
End Sub

Similar Messages

  • I can't log in to game centre but I can log into iTunes. I recently changed my password. I checked the troubleshooter and am getting the message regarding server error but how do I fix this? It doesn't specify this in that article. I don't have firewalls

    I can't log in to game centre but I can log into iTunes. I recently changed my password. I checked the troubleshooter and am getting the message regarding server error but how do I fix this? It doesn't specify this in that article. I don't have firewalls

    Hello sadiepix,
    The following article details several things that can be done to quell iTunes' constant need for authorization.
    iTunes repeatedly prompts to authorize computer to play iTunes Store purchases
    http://support.apple.com/kb/TS1389
    Cheers,
    Allen

  • HT1692 I have duplicate contacts for every contact.  How can I fix this problem?

    I have duplicate contacts for every contact.  How can I fix this problem?

    Hi again,
    I found a previous thread on this that may resolve your problem:
    If you are syncing over the air with iCloud then DO NOT sync via the cable with Contacts. This causes duplicates. You are telling the iPhone to bring what is in those programs to the iPhone (one copy). Then you are syncing from the cloud (copy two).
    The iPhone will do exactly as you tell it to do.
    The easiest way to remove duplicates.
    1. On the info tab in iTunes uncheck sync contact and sync calendars.
    2. On the iPhone>settings>mail contacts calendars>@me.com account>slide Contacts and Calendars OFF
    3. Log into iCloud and look at contacts and calendars and make sure there are no duplicates.
    4. On the iPhone>settings>mail contacts calendars>@me.com account> slide to Contacts and Calendars ON
    When prompted choose to Replace with info from iCloud
    Had to update some of it with iCloud info (it had been written for Mobile Me), but hopefully this will work for you!
    Cheers,
    GB

  • I cannot get itunes to sync all of my songs to my iphone.  Itunes tells me that it cannot locate the files for these songs.  How do I fix this?

    When I attempt to sync my i phone with itunes on my computer not all of the songs make it to my phone.  Itunes is telling me that it cannot find the files for these songs.  How do I fix this?

    Hi fishonfoot,
    Thanks for visiting Apple Support Communities.
    You may want to use this article as a guide to determine if the songs are on your computer:
    iTunes: Finding lost media and downloads
    http://support.apple.com/kb/TS1408
    If the missing songs were purchased from the iTunes Store, see this article for the steps to download them again:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    http://support.apple.com/kb/HT2519
    Best Regards,
    Jeremy

  • My Iphone 4s will not bring up the keyboard to type in the password for updating my apps, how do I fix this?

    My Iphone 4s will not bring up the keyboard to type in the password for updating my apps, how do I fix this?

    Try a Reset... you will not lose data or settings...
    Press and hold the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears. Release the Buttons.
    http://support.apple.com/kb/ht1430

  • HT204053 i dont have the icone icloud on my computer. how can i add it?

    i dont have the apps icloud on my computer. how can i add it?

    Creating an iCloud account: Frequently Asked Questions:
    http://support.apple.com/kb/HT4436
    iCloud requires a newer MacOS X version than given  in your signature.

  • I am a Creative Cloud Member and have the Membership for one Year but in one month it syays expired

    I am a Creative Cloud Member and have the Membership for one Year. It has been only one Month and the Plan says expired. I am not sure what has happened but I am unable to find any Customer Care Number of Adobe.  Can anyone please help. Its Urgent. I use MAC.

    Moving this discussion to the Adobe Creative Cloud forum.
    Abhishek_zico you should be able to contact our support team at Contact Customer Care.  You will want to work directly with our support team regarding the status of your subscription.

  • I have an old itunes library on usb, how do i add this to my new itunes on mac?

    I'm not technically minded, but have managed to put my old itunes library (from my old pc) onto a usb. How do I add this library to my current itunes on my Mac?

    An iTunes "library" is a collection of media and support files all working together.  The .xml file is simply a listing of what tracks you have in your library and where they are located.  You add a .xml file by using the import command in iTunes (I use an older version so I can't tell you exactly where but it should not be hard to find if you look at the various menu category listings).
    Note, if you add just the .xml it will be pointing to files in specific locations.  If that listing is not valid because iTunes cannot find the drive with the files then you will end up with a ton of broken links.
    It might help at this stage to take a step back and tell us exactly what you have on this drive and what you are trying to accomplish.  Sometimes people come here with questions the equivalent to, "How do I use a hammer?" for us only to discover they are trying to get a screw into a wall.

  • How do you add a user defined page size for a "standard" user

    I have been trying to add a User Defined Page size in the Adobe PDF Properties with a "Standard" AD account.  When I click add/modify, no error shows up on the screen but the page size does not show up in the drop down menu.  The only accounts that can add page sizes are "Admin" accounts, as far as I know.  Does anyone know a workaround?  PLEASE HELP!!!

    Firefox unable to store your password without username.
    *https://support.mozilla.org/en-US/kb/password-manager-remember-delete-change-passwords

  • I have itunes version 8.2 and would like to avoid downloading a newer version. The iTunes Store will not leave the page for iTunes 10. How do I fix this?

    The iTunes store will not leave the page for downloading iTunes 10. I just deleted iTunes 10 because of errors to purposely go back to version 8.2. Now I would like to keep 8.2 and not upgrade. How do I get this page to go away, or just keep 8.2? I would like to only have a version before 9.0. Please help!

    The iTunes store will not leave the page for downloading iTunes 10. I just deleted iTunes 10 because of errors to purposely go back to version 8.2. Now I would like to keep 8.2 and not upgrade. How do I get this page to go away, or just keep 8.2? I would like to only have a version before 9.0. Please help!

  • I accidentally deleted my iPhoto from the computer and from recycle bin. How can I get it back? I do not have the iLife disc and don't want to pay the $15 for 2011 version. How can I do this?

    Also, if I buy Lion OS, will it be back or no?

    If you don't have an Installer disk then you can't install without a purchase. Do you have the grey SystemRestore disks that came with your Mac? It's on that. No, iPhoto is not part of Lion.
    Regards
    TD

  • When I try to open a document on the Mac I created it on a month ago, I am told I need a newer version of pages. When I go to the App Store, I am told I have the newest version of Pages. How do I open this document? I need it for work.

    Can't Open Pages Document

    Try opening the document from within Pages - then you will be presented with an "update" dialogue that lets you convert the document to the current version

  • HT1391 I deleted my ringtone from iTunes because I couldn't sync it to my iphone or play it in itunes through the iphone, and now I can't get it back.  I have the purchase receipt...but how do I get it back????? If I can't, can I get refund?

    This is ONE of the MANY reasons, I have held off on getting and iPhone.  Because the ONLY option in getting the music onto it, is by using itunes, instead of just being able to drag and drop.  This is annoying as F***.
    I paid for and downloaded a ringtone from the iTunes store.  It was working fine. Then I hoooked up my iphone to my bf's laptop, competely forgetting that it had already been synced to MINE, which is broken and toasted.  For some reason, it deleted everything off my phone, I spent 3 hours trying to figure out how the **** to get music back onto my iphone using itunes.  It's NOT a user friendly program, and being a computer savvy as I am.....I HATE USING IT. But unfortunately, I don't have a choice. So, I was able to get the two ringtones that I created with my free ringtone maker app BACK into my phone.  But go figure, the one that I actually paid for, I can't get back on.  It was in my itunes, and on my iphone...but had the exclmation mark beside it.  I have already gone to the support page and followed the instructions for retrieving it.  I have manually deleted it from my computer SINCE this discovery, by deleting it from itunes.  So....to make sure yall are understanding this...I tried tracking it down by searching my computer....and I couldn't find it, although it was still listened on BOTH my itunes on my laptop AND in my iphone.  I trued to manually delete it from the iphone....wouldn't work. So i manually deleted it from itunes.
    My question is this....
    HOW ON GODS GREEN EARTH DO I GET IT BACK!!!!????
    It's only $1.29 canadian, but man, this program is ******* me off to no end.
    It's stupid that Apple has completely restricted us.  -sighs gritting her teeth- I just want my ring tone back.  That's it.  I can't even figure out how to redownload it....or if I can even do that.
    Please someone help me.  I'm soooo frustrated.
    Thanks
    CER

    Never mind I fixed it. Just in case anyone else has this problem, after you reinstall iTunes you have to delete all your old music, and if you have iTunes match all the songs you have saved on itunes match will display and you just have to download them to your Macbook.

  • I placed a track of mine on the Global Chord track and when I remove the chords, Logic changes the pitch of all the notes in my project. How can I fix this?

    I dragged and dropped an organ part onto the Chord Global Track in hopes of reading the chord symbols later. However, I continued recording and now that I want to replace a portion of that original track, I can't record over it because Logic keeps transposing every note I play based on the chords in the Global Track. Deleting these chords from the global track ruins every other track I've recorded since then. What can I do to get control back? Thanks so much.
    I'm also seeing big translucent white lines all over the track I imported- those might be sustain pedal cues but I think they have to do with each new chord from the Global track...

    9 hours is a lot of footage for a single Event. That is probably the hangup. Is there a way you could logically divide the event into multiple events? For example, if Martin Scorcese was filming the Woodstock concert, he could divide into Friday, Saturday, Sunday.
    IMovie can use multiple events in a single project, and an event can be used in multiple projects.

  • I want to transfer my ipods itunes collection to a flash drive to be able to use in my cars entertainment system without having the need for my ipod. How can i acomplish this ?

    I would like to transfer my i-tunes collection from my i-pod or back-up drive for use in syncing with my cars infotainment system without having to plu my i-pod in all the time. How do I acomplish this?  thanks.

    First find out if the car's system will play AAC fiiles, as sold in the iTunes Store.
    If it does, read the instructions for the system to find out how to add songs to it, because you have not stated how that is done. No one here can second-guess this.
    If it does not, you will need to convert the songs to a format the system does recognise. You can use iTunes to do that. If you need help with that, you could ask. Once converted, follow step 1, above.
    By the way, call me a sceptic, but one might be suspicious of someone who referred to Apple products as i-pod, or i-tunes, rather than iPod and iTunes and one might even wonder if there was some nefarious reason behind it...

Maybe you are looking for

  • RME 4.3, Inventory Collection doesn't work for 6500

    I have a issue with Inventory collection for 6500 devices running IOS 12.2.33 SXI1, fails with a message, "device collection failed" From IC_Server log i could see SNMP Request timeout exception, so increased SNMP timeout to 10  under device attribut

  • F-54 -  f-44 which one for adv pmnt clearing

    which t.code is used for adv pmnt clearing f-54 or f-44

  • How to run EMET on all Process (tabs) of the Modern IE (Metro)

    Hi, i have the problem that EMET is only running on the first open Tab-process in my Modern IE.(metro) Body text cannot contain images or links until we are able to verify your account... In this picture i have 3 Tabs open in modern IE and on the EME

  • Preserve RGB colors in PDF/X

    Is there a way to preserve RGB colors in a PDF/X document? I always believed a PDF/X-3 allows RGB colors, but does flatten transparency. I tried that but all RGB colors become CMYK, even with "no color conversion" set in the output tab. We need it fo

  • Drop-down menus and submitting completed forms

    Hi,   I have two questions: 1)  On my form I have multiple drop-down menus.  Is there a way to allow the user to return the field to its original blank state once an item is selected from the menu?  I noticed that I could add a choice to the menu tha