Sub App_Start
gotoSub("thisSub")
appClose
End Sub
Sub gotoSub (whichSub)
ErrorLabel(gotoError)
inError = false
AddComboBox("Form1", whichSub, 0, 0, 0, 0)
control(whichSub).Add(0)
control(whichSub).Add(1)
control(whichSub).SelectedIndex = 0
AddEvent(whichSub, SelectionChanged, whichSub)
'The event SelectionChanged will trigger the call
control(whichSub).SelectedIndex = 1
control(whichSub).Dispose
return
gotoError:
if inError then return
inError = true
if control(whichSub).Count = 2 then
Msgbox ("Error: Calling another gotoSub(" & chr(34) & whichSub & chr(34) & ") before the first one finished!", "thisSub", cMsgboxOK, cMsgBoxExclamation)
end if
return
End Sub
Sub thisSub (a,b)
Msgbox ("How did you get in thisSub?", "thisSub", cMsgboxOK)
gotoSub ("anotherSub")
End sub
Sub anotherSub (a,b)
Msgbox ("Another dynamically called sub.", "AnotherSub", cMsgboxOK)
'The next gotoSub causes an error
gotoSub ("thisSub")
End sub
In your way you are disposing controls before the event is fired
It would be nice to have our own defined 'selecteditem' value instead..or a way to direct link a table field as selectedindex and another tablefield as the item() value)
keep in mind that if you operate both arrays at the same time, your relation stays unchangeable...
'------------------------------------------------------
Sub addComboValues(forCARD, forField, fromTbl, fromFld)
'------------------------------------------------------
comboFld = cardInfo(forCARD).frmPrefix & forField
AddArrayList(comboFld & Arr)
for ii = 0 to control(fromTbl).RowCount-1
cellVal = control(fromTbl).Cell(fromFld,ii)
control(comboFld).Add(cellVal)
control(comboFld & Arr).Add(control(fromTbl).Cell("NR",ii))
next
End Sub
I'm not sure if this is the code in your code.
Sub Combo1_Event
...
timer1.interval = 10 'ms
timer1.enabled = true
end sub
Sum Timer1_Tick
Timer1.Enabled = false
Combo1.Dispose
End Sub
I think the yesterday approach drives to a chaos.
Sub gotoSub (whichSub)
select whichSub
case "thisSub"
thisSub(1,2)
return
case "anotherSub"
anotherSub(1,2)
return
end select
End Sub
form's Show methodI my case I not aways have a .show. When adding a record i.e. I just clear out fields, set some defaults and return to the screen which was already there.
I also thought the .show would be a solution (it's nice to see we all do things the same way.
Now I'm using the select case method, coding out every sub I want to call. It's safe, but does not fit in my template the way I want it.
We'll just wait for the real Call (var) in the next release.
Scub
I'm always looking for boundariesYou're code is like playing with fire
I know, but I was looking for a temporary way doing the same in the meantime, but the fire is getting to hot.Next version will include a simple CallSub(String) method.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?