I got this working now. Here is what you need to do to get it working:
Create a simple list with these 2 lines of code
Dim entityDimPk1 As DimPk = api.Dimensions.GetDim("YourEntityDimName").DimPk
Dim objEntityMemberInfos1 As List(Of MemberInfo) = api.Members.GetMembersUsingFilter(entityDimPk1,"E#" & cvEntity & ".Base",Nothing)
In the code above I'm passing in a parent Entity parameter value called cvEntity and then loading the Base members of that to the list
Then do a For Each loop around your Data Buffer call. Don't forget the second Next after, and outside of the Data Buffer call
For Each objEntityMemberInfo As MemberInfo In objEntityMemberInfos1
Dim entityFromList As String = objEntityMemberInfo.Member.Name
Your Data Buffer Call
If
.....
Next
End If
Next