CodeCharge Studio

Use the Before Show Event to Alter a Label's Value

  1. Select the Label user_id_assign_by in the Project Explorer.
  2. In the Properties window click on the Data tab.
  3. Select Text for the Data Type property.
  4. In the Properties window click on the Events tab.
  5. Right-click on Before Show event and select Add Code.... .

    CodeCharge Studio should then automatically switch to Code view.

  6. Once in Code view, replace the following text:
    'Write your own code here.
    with the following:
    If tasks.EditMode Then
       tasks.user_id_assign_by.Value = CCDLookUp("emp_name", "employees", "emp_id=" &_
             DBIntranetDB.ToSQL(tasks.user_id_assign_by.Value, ccsInteger), DBIntranetDB)
    Else
       tasks.user_id_assign_by.Value = CCDLookUp("emp_name", "employees", "emp_id=" &_
             DBIntranetDB.ToSQL(CCGetUserID(), ccsInteger), DBIntranetDB)
    End if

    The above code consists of the following elements:


    The whole code reads approximately as follows:


Next: Add a Hidden "Assigned By" Field to Auto-Update New Tasks


On-line, printable versions and updates