|
-
Jul 17th, 2008, 10:56 PM
#1
Thread Starter
Member
-
Jul 17th, 2008, 11:01 PM
#2
Thread Starter
Member
Re: confused now ...
does "myRecords" object holds the reference/pointer value to the 10 rows with 7 columns? (like a multidimensional array???)
-
Jul 17th, 2008, 11:16 PM
#3
Re: confused now ...
When you create a RecordDefinition object those last two fields are implicitly created as well.
Code:
Public Class RecordDefinition
Public WarnCode As String = ""
Public WarnDesc As String = ""
Public WarnType As String = ""
Public NewHdr As New NewMsgText()
Public NewFtr As New NewMsgText()
End Class
A New RecordDefinition automatically contains those two New NewMsgText objects.
-
Jul 18th, 2008, 04:07 AM
#4
Thread Starter
Member
Re: confused now ...
yes, but in the collections list, how come the "add" method only adds 3 fields and not all of them, and yet when the program accesses the object "myRecords" it can display those extra 4 fields as well?
-
Jul 18th, 2008, 04:11 AM
#5
Thread Starter
Member
Re: confused now ...
 Originally Posted by layne
‘oReader HAVE 10 ROWS WITH 7 COLUMNS here
While oReader.Read()
dsCode = "" & oReader("Code")
dsDescr = "" & oReader("Descrip")
dsType = "" & oReader("Type")
dsHeadText = "" & oReader("TextHead")
dsHeadHTML = "" & oReader("HTMLHead")
dsFootText = "" & oReader("TextFoot")
dsFootHTML = "" & oReader("HTMLfoot")
‘THIS IS ADDING TO COLLECTION BASE, BUT WHY ONLY 3 FIELDS???
myRecords = oWarning.Add(dsCode, dsDescr, dsType)
With myRecords.NewHdr
.Txt = dsHeadText
.HtmTxt = dsHeadHTML
End With
With myRecords.NewFtr
.Txt = dsFootText
.HtmTxt = dsFootHTML
End With
End While
End Class[/CODE]
the program adds to collection, but the remaining 4 fields are being overwritten by the "with - end with" blocks, so how come the object "myRecords" seem to have the rows???
thanks
-
Jul 18th, 2008, 06:13 AM
#6
Member
Re: confused now ...
oWarning.Add() initializes myRecords and sets the value of the first three variables.
After that, the "with - end with" blocks are setting values to myRecords.NewHdr.Txt etc. by direct assignment.
So now you have a RecordDefinition instance called myRecords with 7 variables that have been assigned some values. What's the question? What do you mean by "rows"?
Edit: To be more specific, myRecords is being created in the above way then added to the instance of WarningAdvisor called oWarning each step of the while loop. If oReader has 10 "rows" and one row is passed every time its Read() function is called, then you have an object of type WarningAdvisor called oWarning that contains 10 objects of type RecordDefinition, each of which has 7 variables that now have values which were contained in the "collumns" of oReader.
Hope that made sense.
Last edited by Daarklord; Jul 18th, 2008 at 06:23 AM.
0xABADA55D00D
-
Jul 18th, 2008, 04:08 PM
#7
Thread Starter
Member
Re: confused now ...
geez, thanks for that Daarklord, I never noticed the:
Public Function Add(ByVal xCode As String, ByVal xDescr As String, ByVal xType As String) As RecordDefinition
Dim _thisItem As New RecordDefinition()
that it creates a NEW object then add to collection. I hope I can figure the rest.
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
|