•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 397,120 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,406 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser:
Views: 5510 | Replies: 2
![]() |
•
•
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 10,880
Reputation:
Rep Power: 32
Solved Threads: 107
#2
May 9th, 2003
This is untested, but something like this might work
string timeZone[3], state, zone timeZone[0] = "CST" timeZone[1] = "EST" timeZone[2] = "PST" if state="AL" then zone=timeZone[0] if state="NY" then zone=timeZone[1] if state="CA" then zone=timeZone[2]
Dani the Computer Science Gal
Do you run a computer-related website? Feature it in our niche link directory!
Do you run a computer-related website? Feature it in our niche link directory!
#3
May 10th, 2003
Close Dani :-), but this isn't C/Java :-P.
First of all, I'm assuming your using VB6. If you're not, tell me what VB version you're using and I'll adjust the code.
A better way of implimenting this, is to add a Class Module. I named my class module clsStateTime, and this is the code inside it:
You should fill in the other 50 states with the results you want. To use this class, I made this code under a command button (but, you could do it however you want):
Just as a note, the index is the number in between the ()!
Dani, notice how I Dim'ed it with a (2), but I used 3 "slots" in the array? Thats another VB difference :-P. Oh yeah, we don't dim vars with the type first either :-P.
First of all, I'm assuming your using VB6. If you're not, tell me what VB version you're using and I'll adjust the code.
A better way of implimenting this, is to add a Class Module. I named my class module clsStateTime, and this is the code inside it:
Public state As String
Public Function TimeZone() As String
Select Case UCase(state)
Case "NY"
TimeZone = "EST"
Case "NJ"
TimeZone = "EST"
Case Else
TimeZone = "Unknown"
End Select
End FunctionYou should fill in the other 50 states with the results you want. To use this class, I made this code under a command button (but, you could do it however you want):
Private Sub Command1_Click()
'The index holds the amount of values you want to put in the array
Dim stinfo(3) As New clsStateTime
stinfo(0).state = "nj"
stinfo(1).state = "ny"
stinfo(2).state = "asdf"
MsgBox (stinfo(0).TimeZone)
MsgBox (stinfo(1).TimeZone)
MsgBox (stinfo(2).TimeZone)
End SubJust as a note, the index is the number in between the ()!
Dani, notice how I Dim'ed it with a (2), but I used 3 "slots" in the array? Thats another VB difference :-P. Oh yeah, we don't dim vars with the type first either :-P.
-Ryan Hoffman
ASP.NET Specialist / Webmaster, Extended64.com.
Please do not email or PM me with support questions. Please direct them to the forums instead.
ASP.NET Specialist / Webmaster, Extended64.com.
Please do not email or PM me with support questions. Please direct them to the forums instead.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Visual Basic 4 / 5 / 6 Marketplace
- Can I ghost a RAID array??? (Windows NT / 2000 / XP / 2003)
- Creating dynamic array structures (C++)
- Array limit (C)
- struct dynamic 2d array alloc (C)
- string to integer array transformation (C)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: static compile
- Next Thread: HELP WITH FTP, PLEASE:



Linear Mode