input box in an array

code snippet for a weekdays array

Page 1 of 1

3 Replies - 4722 Views - Last Post: 01 May 2005 - 08:34 PM Rate Topic: -----

#1 VBb/cIhv2  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 01-May 05

input box in an array

Post icon  Posted 01 May 2005 - 10:11 AM

:huh: 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. :)

Is This A Good Question/Topic? 0
  • +

Replies To: input box in an array

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 250
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: input box in an array

Posted 01 May 2005 - 11:19 AM

Something like the following should do the trick
 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.
Was This Post Helpful? 0
  • +
  • -

#3 VBb/cIhv2  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 01-May 05

Re: input box in an array

Posted 01 May 2005 - 08:30 PM

thank-you
Was This Post Helpful? 0
  • +
  • -

#4 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1956
  • View blog
  • Posts: 20,394
  • Joined: 17-March 01

Re: input box in an array

Posted 01 May 2005 - 08:34 PM

Let us know how it works out, and welcome to dream.in.code!!!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1