The C# Station Tutorial -1

Lesson 1: Getting Started with C#

Understand the basic structure of a C# program.
Obtain a basic familiarization of what a “Namespace” is.
Obtain a basic understanding of what a Class is.
Learn what a Main method does.
Learn how to obtain command-line input.
Learn about console input/output (I/O).
namespace WelcomeCSS
{
class InteractiveWelcome
{
public static void Main()
{
Console.Write("What is your name?:");
string name = Console.ReadLine();
Console.WriteLine("Hello, {0}!", name);
Console.WriteLine("Welcome to the C# Station Tutorial!");
Console.ReadLine();
}
}
}

Access: How to print a report footer at the end of the last page.

In MS Access, a report footer only shows at the end of the report, not the end of last page. In my Microsection report, I want a fixed height signature area to be at the end of last page. In that way it just looks professional.

Microsoft KB 208979 introduced three methods to achieve it.

  • Place the information in the report’s page footer, which is always printed at a fixed location. (really not what I want)
  • Set the report properties for the footer section. (the one I used)
  • Set the report properties for the detail section. ( have not had a chance to try it)
  • The 2nd method is the one I used, it involves using the repot’s MoveLayout, PrintSectoin, and NextRecord properties.
    Create a function named SetGrpFtrLoc in the repot’s module section.

    Function SetGrpFtrLoc(Rpt as Report, GrpFtrLoc as Double)
    GrpFtrLoc=GrpFtrLoc*1440 'Convert from inches to twips.
    If Rpt.top < GrpFtrLoc Then 'Not at location yet, so
    Rpt.movelayout = True 'move to next print location.
    Rpt.nextrecord = False 'Do not go to next record.
    Rpt.printsection = False 'Do not print the section.
    End If 'Until the required offset is reached
    End Function

    Create a dummy group and set it to “One to Many” relation so that all sections will show up. Set the dummy group to be the very top level in the “grouping and sorting” of the report and show only the footer of the dummy group. Set the dummy footer properties as follow:
    Height: 0.3 in. (or the height of the signature area)
    ForceNewPage : After Section
    OnFomat: = SetGrpFtrLoc([Report], 10)

    The parameter 10 indicated that I want the signature area to begin at least 10 inches from the top of the page. The calculation is following: my page margin is 0.25, page footer is about 0.33 and the page is 11 inch high. Some margin need to be preserved between signature area and page footer.

    Different ways to achieve this can be found at various forums, but I found the one from Microsoft KB is the most straight forward one.

    You can not add report footer if you go this way! The footer will appear after the end of group footer.

    Use Cross Join In MS Access

    Our Microsection report needs to have same serial number for each and every hole type. Using VBA to generate a table, which has a field of hole_type and a field of SN, sure will work. However; a proper and elegant way is to use a cross join to link two tables.

    Tbl_Hole:
    H_Type             Text     (PTH; Blind_Via; Micro_Via etc)
    H_Name           Text     (Thermal Stress; As is; L1-3; L8-9 etc)

    Tbl_SN:
    SN                   Text     (1, 2, 3, 4, 5, etc)

    SQL (qry_HoleType_SN):
    SELECT *
    FROM tbl_Hole, tbl_SN;

    From a graphical query builder
    Add both tables and ensure there is no link between them.

      Below is what I got.

      H_Type H_Name SN
      Blind Via L1-2 1
      Blind Via L1-2 2
      Blind Via L1-2 3
      Blind Via L1-2 4
      Blind Via L1-2 5
      Blind Via L8-9 1
      Blind Via L8-9 2
      Blind Via L8-9 3
      Blind Via L8-9 4
      Blind Via L8-9 5
      PTH As Is 1
      PTH As Is 2
      PTH As Is 3
      PTH As Is 4
      PTH As Is 5
      PTH Thermal Stress X 1
      PTH Thermal Stress X 2
      PTH Thermal Stress X 3
      PTH Thermal Stress X 4
      PTH Thermal Stress X 5
      PTH Thermal Stress Y 1
      PTH Thermal Stress Y 2
      PTH Thermal Stress Y 3
      PTH Thermal Stress Y 4
      PTH Thermal Stress Y 5