Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 131,697 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 2,519 people online right now. Registration is fast and FREE... Join Now!




input box in an array

 
Reply to this topicStart new topic

input box in an array, code snippet for a weekdays array

VBb/cIhv2
post 1 May, 2005 - 09:11 AM
Post #1


New D.I.C Head

*
Joined: 1 May, 2005
Posts: 13

huh.gif This is probably a simple question butI am having a brain fart right now. I am writing a code snippet for vb class @ ITT and I can't figure out what code I need to put in for the number from input box to make the day of the week pop up in a msgbox. Here is what Ihave already written :

Dim strWeekdays (1 To 7) As String Dim x As Integer strWeekdays(1) = “Sunday” strWeekdays(2) = “Monday” strWeekdays(3) = “Tuesday” strWeekdays(4) = “Wednesday” strWeekdays(5) = “Thursday” strWeekdays(6) = “Friday” strWeekdays(7) = “Saturday” inputbox “Pick a number 1 – 7 to display it’s coinciding weekday”

Any help wouldbe much appreciated. smile.gif
User is offlineProfile CardPM

Go to the top of the page


Amadeus
post 1 May, 2005 - 10:19 AM
Post #2


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 12,163



Thanked 32 times

Dream Kudos: 25
My Contributions


Something like the following should do the trick
CODE

Dim strWeekdays(1 To 7) As String
Dim counter As Integer
strWeekdays(1) = "Sunday"
strWeekdays(2) = "Monday"
strWeekdays(3) = "Tuesday"
strWeekdays(4) = "Wednesday"
strWeekdays(5) = "Thursday"
strWeekdays(6) = "Friday"
strWeekdays(7) = "Saturday"
counter = InputBox("Pick a number between 1 and 7")
MsgBox strWeekdays(counter)

Please note that this is a base code snippet...it does not validate any inpur or perform any of the error checking that should be incorporated into a program.
User is online!Profile CardPM

Go to the top of the page

VBb/cIhv2
post 1 May, 2005 - 07:30 PM
Post #3


New D.I.C Head

*
Joined: 1 May, 2005
Posts: 13

thank-you
User is offlineProfile CardPM

Go to the top of the page

skyhawk133
post 1 May, 2005 - 07:34 PM
Post #4


Head DIC Head

Group Icon
Joined: 17 Mar, 2001
Posts: 14,829



Thanked 45 times

Dream Kudos: 1650

Expert In: Web Development

My Contributions


Let us know how it works out, and welcome to dream.in.code!!!
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/20/08 08:46AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month