Visual Basic Sample Snippet

Here is how to user our Paycheck Withholding from a Visual Basic program

Structures

All structures you will need are defined in our online manual (in 'c' format) or in the 'c' header file wh32.h. Here are several to show you how these would look in Visual Basic.
 
Structure MDATE
  Dim month As Long
  Dim day As Long
  Dim year As Long
  End Structure
Structure WITHHOLDING_TAXBODY_ID
  Dim struct_size As Long
  Dim error_return As Long
  Dim state As Long
  Dim muni_type As Long
  Dim prompt_number As Long
  Dim desired_entry As Long
  Dim number_of_entries As Long
  Dim muni_number As Long
  Dim calc_number As Long
End Structure

Function Declarations

You must declare the Withholding32 functions you will use. The first time you actually call one of these functions it will be loaded into memory by the operating system. Below is an example.  The 'wh32.dll' file should be placed in the same folder as your progams executable.  In the development stage this would be the 'debug' or 'release' folder depending on your build.
 
Declare Function WH32_Get_Prompt Lib "wh32.dll" (ByRef id As WITHHOLDING_TAXBODY_ID, ByVal ss As String) As Long

Sample Execution Code

Here is a code snippet which shows how you would actually use one of the Withholding32 functions. This particular snippet sets up an array of county names and calculation codes for Marylang. Note that it is required that any structure with a 'struct-size' member be filled in correctly before calling the function.
Public Const WH32_MARYLAND As Short = 25                                 'c language wh32.h has all defined
Dim wid As WITHHOLDING_TAXBODY_ID
Dim l As Long
Dim numberofthem As Long
Dim i As Long

thenam = "                                                             " 'pass at least 60 char blank
wid.struct_size=Len(wid)                                                 'required
wid.state = WH32_MARYLAND
wid.muni_type = 0
wid.desired_entry = 0
l = WH32_Get_Prompt(wid, thenam)                                         ' get number of entries
numberofthem = wid.number_of_entries
For i = 0 To numberofthem - 1
  wid.desired_entry = i
  l = WH32_Get_Prompt(wid, thenam)
  marylandcounty.Items.Add(thenam)
  county_calc_number(i) = wid.calc_number
Next