|
|
|
||||
|
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() |
|
|||||||
| Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
|
Thread Tools |
|
|
#1 |
|
Confirmed User
Join Date: Jun 2003
Location: AssTown
Posts: 674
|
I want to fill an array with data but there must be an easier way than this.
Dim MyArray$(7) MyArray$(1) = "Monday" MyArray$(2) = "Tuesday" MyArray$(3) = "Wednesday" What I really want is something like this. Dim MyArray$(7) Data "Monday","Tuesday","Wednesday" ..... then use a loop to add the data to the array. I could store the data in a text file and read it in like this Open "data.txt" For Input As #1 Do x = x + 1 Input #1, a$ MyArray$(x) = a$ Loop Until EOF(1) Close but I want my data string to be stored within the program. ![]()
__________________
I sale lube |
|
|
|
|
|
#2 |
|
Confirmed User
Join Date: Dec 2002
Location: New Jersey
Posts: 5,248
|
You could store them as comma delimited or whatever then use a function to loop through them and put them in an array I guess.
__________________
icq 279990726 www.mcdonalds.com <- great money making opportunity |
|
|
|
|
|
#3 |
|
Confirmed User
Join Date: May 2003
Posts: 158
|
There aren't too many different ways.
<% Dim mArray(11) mArray=Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December") %> |
|
|
|
|
|
#4 |
|
Chafed.
Join Date: May 2002
Location: Face Down in Pussy
Posts: 18,041
|
2 ways come to mind and there are probably better ones:
1)define a string variable with comma delimeters and then use a string tokenizer or 2)similar to above but use the SPLIT() function which automatically tokenizes a string and returns an array with all the tokens as the array elements. have fun! |
|
|
|
|
|
#5 | |
|
Confirmed User
Join Date: Jun 2003
Location: AssTown
Posts: 674
|
Quote:
In old basics you could just use the "Data" and "Read" but VB don't appear to have such a function. If you gad a string like .... MyData$="Monday,Tuesday,Wednesday,Thursday" how would you put them into an array? ![]()
__________________
I sale lube |
|
|
|
|
|
|
#6 |
|
Chafed.
Join Date: May 2002
Location: Face Down in Pussy
Posts: 18,041
|
|
|
|
|
|
|
#7 |
|
Confirmed User
Join Date: Oct 2003
Location: Canada
Posts: 163
|
Dim Days() as String = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }
remember VB starts its arrays at 0... so sunday is day(0) not day(1).
__________________
eR :: beauty is in the eye of the beer-holder :: |
|
|
|
|
|
#8 |
|
Confirmed User
Join Date: Oct 2002
Location: Sarasota, FL
Posts: 973
|
here is a little code i threw up, shows you start with a string then add's data to it. hope this is what you were looking for
Function Dates() Dim strDay As String, iCount As Integer strDay = "Monday,Tuesday,Wednesday,Thursday,Friday,Saturday ,Sunday" strDates = Split(strDay, ",") For iCount = LBound(strDates) To UBound(strDates) strDates(iCount) = strDates(iCount) & " Index (" & iCount & ")" & vbNewLine MsgBox strDates(iCount) Next iCount End Function
__________________
icq: 2721653 |
|
|
|
|
|
#9 | |
|
Chafed.
Join Date: May 2002
Location: Face Down in Pussy
Posts: 18,041
|
Quote:
|
|
|
|
|
|
|
#10 | |
|
Confirmed User
Join Date: Oct 2002
Location: Sarasota, FL
Posts: 973
|
Quote:
__________________
icq: 2721653 |
|
|
|
|
|
|
#11 | |
|
Confirmed User
Join Date: Jun 2003
Location: AssTown
Posts: 674
|
Quote:
Unfortunately its not supported in my old version of VB, I guess its time to upgrade.
__________________
I sale lube |
|
|
|
|
|
|
#12 | |
|
Confirmed User
Join Date: Jun 2003
Location: AssTown
Posts: 674
|
Quote:
I feel so old and out of date ![]()
__________________
I sale lube |
|
|
|
|