kunfuzed1
09-10-2003, 07:03 PM
Alright guys..
if you would be so kind as to tell me if im on the right track or not..
I realize that with control arrays, i can use WhateverControl(index) to reference the control and vb controls whatever one has focus or whatever.. i dont know if im explaining that quite right.. but hopefully you'll get it.
What I want to know is if I can do the same thing somehow with variables.. I have a variable array dtStartTime(48) as date
what i'd like to do is for each set of controls i have, automatically put the information into a variable array. So far im not doing it right.
Option Explicit
dim dtStartTime(48) as Date
dim dtEndTime(48) as Date
Private Sub cmdCalculate_Click(Index As Integer)
dtStartTime(Index) = CDate(txtStartTime(Index).Text)
dtEndTime(Index) = CDate(txtEndTime(Index).Text)
MsgBox dtStartTime(Index) & " " & dtEndTime(Index)
End Sub
I KNOW this isnt correct, obviously because it doesnt work right and it just doesn't even look right to me.. but my question is, is it possible to do what i want? I can call control names by (index) and it does what i want it to do as far as putting the right information in the right places.. and i realize that index is declared as an integer by the control name, is there something i can do like that for a variable array?
if you would be so kind as to tell me if im on the right track or not..
I realize that with control arrays, i can use WhateverControl(index) to reference the control and vb controls whatever one has focus or whatever.. i dont know if im explaining that quite right.. but hopefully you'll get it.
What I want to know is if I can do the same thing somehow with variables.. I have a variable array dtStartTime(48) as date
what i'd like to do is for each set of controls i have, automatically put the information into a variable array. So far im not doing it right.
Option Explicit
dim dtStartTime(48) as Date
dim dtEndTime(48) as Date
Private Sub cmdCalculate_Click(Index As Integer)
dtStartTime(Index) = CDate(txtStartTime(Index).Text)
dtEndTime(Index) = CDate(txtEndTime(Index).Text)
MsgBox dtStartTime(Index) & " " & dtEndTime(Index)
End Sub
I KNOW this isnt correct, obviously because it doesnt work right and it just doesn't even look right to me.. but my question is, is it possible to do what i want? I can call control names by (index) and it does what i want it to do as far as putting the right information in the right places.. and i realize that index is declared as an integer by the control name, is there something i can do like that for a variable array?