|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
using user defined typesprogram. Then, at the appropriate time, I would like to loop through the collection and send each udt in it to a subroutine to be processed. I had though it would be done as follows but have several problems, as you can probably see. One is to cast the collection item to the AuthInfo type, and the other is to pass the AuthInfo item into the subroutine. Can some one give me some guidance on the use of collections for this in VB6? Thanks in advance fro your help. Dave Public Type AuthInfo scanSO As String tndSO As String authLevel As Long authOperator As String operLevel As Long authTime As Date End Type Public g_udtAuthCol As Collection private sub somesub() dim audt as AuthInfo with audt .scanSO = "something" . . end with g_udtAuthCol.Add(audt) end sub private sub finishup() dim anEvent as AuthInfo dim lpc as integer for lpc = 0 to g_udtAuthCol.Count -1 anEvent = g_udtAuthCol.Item(lpc) processEvent(anEvent) next end sub private processEvent(e as AuthInfo) 'do stuff to e here end sub > I have a udt set up and a collection that I add the udts to throughout a <code snipped>> program. Then, at the appropriate time, I would like to loop through the > collection and send each udt in it to a subroutine to be processed. I had > though it would be done as follows but have several problems, as you can > probably see. One is to cast the collection item to the AuthInfo type, and > the other is to pass the AuthInfo item into the subroutine. > > Can some one give me some guidance on the use of collections for this in > VB6? UDT's cannot be stored in collections (unless they're declared externally from your application), either use an array for this instead or better still, write your own AuthInfo collection object which just uses a dynamic array internally. This object could also include the functionality to process each UDT in the collection, a much neater solution IMO. Hope this helps, Mike - Microsoft Visual Basic MVP - E-Mail: ED***@mvps.org WWW: Http://EDais.mvps.org/ Thank you Mike, I appreciate the suggestion.
Dave Show quoteHide quote "Mike D Sutton" <ED***@mvps.org> wrote in message news:%23oAcC19XFHA.2588@TK2MSFTNGP14.phx.gbl... >> I have a udt set up and a collection that I add the udts to throughout a >> program. Then, at the appropriate time, I would like to loop through the >> collection and send each udt in it to a subroutine to be processed. I had >> though it would be done as follows but have several problems, as you can >> probably see. One is to cast the collection item to the AuthInfo type, >> and >> the other is to pass the AuthInfo item into the subroutine. >> >> Can some one give me some guidance on the use of collections for this in >> VB6? > <code snipped> > > UDT's cannot be stored in collections (unless they're declared externally > from your application), either use an array > for this instead or better still, write your own AuthInfo collection > object which just uses a dynamic array internally. > This object could also include the functionality to process each UDT in > the collection, a much neater solution IMO. > Hope this helps, > > Mike > > > - Microsoft Visual Basic MVP - > E-Mail: ED***@mvps.org > WWW: Http://EDais.mvps.org/ > >
Need some help in compressing bmp file to jpeg file
Get rid of flicker inside a frame. VB6 don't see events of the implemented interface checkbox always is disabled!!!! Simulating relational database with text files X-axis value of Excel chart load extern exe file into mdi framework? Installing Fonts Optimizing Binary File Input Import Wizard for VB.Net |
|||||||||||||||||||||||