Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Padding UDT's in VB

Posted on 2002-07-05
Medium Priority
Last Modified: 2010-05-02
I have a VB4 project and I have migrated to VB6. The app lication is making use of UDT's and I seem to have a problem with alignment. Can anyone help me here??

This is an example of one of the UDT's:-

Type typInvestCbl
    intVInvSeqNo                    As Integer
    intMVInvNumber                  As Integer
    dblMVInvBase                    As Double           'Curr I/O - updated by CBL
    dblMVPremAllocation             As Double           'I/O
    dblMVUnitValue                  As Double           'Curr I/O - updated from UV tbl
    dblMVUnitValueGainLoss          As Double
    dblMVUnitValueLast              As Double
    dblVInvUnits                    As Double
    dblVLastInvBase                 As Double
    dblVUpdInvBase                  As Double
    dblVInvEarnings                 As Double
    dblVLoanGuarInt                 As Double
    dblVAdjInvBase                  As Double
    dblVIntFactor                   As Double
    dblVSplitNIP                    As Double
    dblVMortCharge                  As Double
    dblVAdminCharge                 As Double
    dblVMortGiveback                As Double
    dblVGuarMinDeathBen             As Double
    dblVBenPremium                  As Double
    dblVSalesCharge                 As Double
    dblVExpenseCharge               As Double
    dblVUPBCharge                   As Double
    dblVRdrMlyTerMchg               As Double
    dblVNetGainLoss                 As Double
End Type

Type typInvestInputCbl
    strVStart                       As String * 8
    intMVInvDivCounter              As Integer
    ProductInvestCbl(20)            As typInvestCbl
End Type
Question by:DianeCrawford
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +2
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7131489
What do you mean by "problem with alignment" ?

Author Comment

ID: 7131499
I have padding issue.....VB4 uses WORD alignment and VB6 uses DWord alignment so my UDT's not aligned properly when passed to an external dll....

Expert Comment

ID: 7131514
a.. not sure about your problem.. hehe...
how about change your font to courier new?
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7131515
Yes, VB4 is 16bit and VB6 32bit. I guess that the external dll is also only 16bit, which explains the problem.
To solve, I would try to get the external dll also as 32-bit...

Accepted Solution

pierrecampe earned 800 total points
ID: 7131572
in the Type typInvestInputCbl
strVStart As String * 8
is actually 16 bytes long in vb6
in vb1-4 it was 8 bytes (i think)
so maybe the external dll expects 8 bytes and gets 16 ?

Expert Comment

ID: 7132924
HEY, whats with the 'C' grade
if you dont like a comment then DO NOT accept it as an answer
so WHY is the 'C' ?

Expert Comment

ID: 7133010
Please read below.  Due to no explanation, grade changed.

E-E Moderator

How Do I Know What Grade to Give?
Although we use an A-D scale here at Experts Exchange, it works differently than, say, school grades. If one or more Experts' proposals are accepted as answers, they should usually be given an A or B grade, since they have taken the time to provide you with a working solution. If a possible solution is incomplete - ask for clarification or details before accepting the answer and grading it. People should not be given lower grades because of incorrect grammar or because you just accepted their answer or comment to close the question. Keep in mind, your question and any follow-up comments should be focused so that there can be a specific answer. The following is a good guideline to follow when grading:

A: The Expert(s) either provided you with a thorough answer or they provided you with a link to information that thoroughly answered your question. An "A" can also be given to any answer that you found informative or enlightening beyond the direct question that you asked.

B: The Expert(s) provided an acceptable solution, or a link to an acceptable solution, that you were able to use, although you may have needed a bit more information to complete the task.

C: Because Experts' reliability are often judged by their grading records, many Experts would like the opportunity to clarify if you have questions about their solutions. If you have given the Expert(s) ample time to respond to your clarification posts and you have responded to each of their posts providing requested information; or if the answers, after clarification, lack finality or do not completely address the issue presented, then a "C" grade is an option. You also have the option here of just asking Community Support to delete the question.

Remember, the Expert helping you today is probably going to be helping you next time you post a question. Give them a fair chance to earn an 'Excellent!' grade and they'll provide you with some amazing support.


Author Comment

ID: 7137124
Sorry Experts,

I was unaware that I gave a grade C and I didn't know until today that there was a grading system.....

Sorry this will not happen again.....

Thanks for everyone help in the past and I hope I can get help in the future....

Author Comment

ID: 7137134
Sorry Experts,

I was unaware that I gave a grade C and I didn't know until today that there was a grading system.....

Sorry this will not happen again.....

Thanks for everyone help in the past and I hope I can get help in the future....

Expert Comment

ID: 7137557
i hereby appologize for shouting at you

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question