|
-
Jun 17th, 2010, 03:11 AM
#1
Thread Starter
Member
Need advise in for loop
Hi all,
Recently, I have already ask a lot and here's another question. I wanted to use loop to loop Write_Text("A1", 1, 1), A2 = Write_Text("B1", 1, 1), ......
Code:
Private Sub Write_Text(ByRef A, ByVal B, ByVal C)
List1.AddItem A & " | " & B & " | " & C
End Sub
Private Sub Run_Button_Click()
Dim i As Integer
for i = 1 To 2
' I wanted to go to Sub Data_Storage() and use loop to loop A1 and A2 in here
next i
End Sub
Private Sub Data_Storage()
A1 = Write_Text("A1", 102, 13)
A2 = Write_Text("B1", 15, 19)
A3 = Write_Text("B2", 19, 60)
:
:
End Sub
Need some advise.
Thanks
-
Jun 17th, 2010, 03:19 AM
#2
Re: Need advise in for loop
vb Code:
'create a User Defined Type to hold the parameters
Private Type tIOCommand
sCmd as String
lValA as Long
lValB as Long
End Type
Dim wtCmds() as tIOCommand 'declare a variable as the type
ReDim wtCmds(num_of_commands -1) 'dimension array, in case you have multiple lists
'init the values
wtCmds(0).sCmd = "A1"
wtCmds(0).lValA = 102
wtCmds(0).lValB = 13
'etc... do this for all of them... incrementing the index for each
Static lResumeOn as Long
Dim i as Long
'Private? bolCancel as Boolean
'check to make sure it's valid...
If lResumeOn > UBound(wtCmds) then lResumeOn = 0
For i = lResumeOn to UBound(wtCmds)
Write_Text(wtCmds(i).sCmd, wtCmds(i).lValA, wtCmds(i).lValB
DoEvents
If bolCancel = True then
lResumeOn = i + 1
Exit Sub
End If
Next i
'reset resume on
lResumeOn = 0
Experiment with that.
Last edited by FireXtol; Jun 17th, 2010 at 03:22 AM.
Software I use and highly recommend: Opera, Miranda IM, Peerblock, Winamp, Unlocker Assistant, JoyToKey, Virtual CloneDrive, Secunia PSI, ExplorerXP, GOM Player, Real Alternative, Quicktime Alternative,Sumatra PDF, and non-freeware: Photoshop and VB6( ).
My codebank: AllRGB, Rounded Rectangle(math), Binary Server, Buddy Paint, LoadPictureGDI+, System GUID/Volume Serial, HexToAsc, List all processes and their paths, quasiString matching
Strings(search, extraction, retrieval etc): Retrieve BBCode Link from HTML, RemoveBetween ()'s, strFindBetween(str1,str2), Insert text in HTML, HTML - GetSpanByID
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|