Photo AI

Write code in the 'OnCreate' event handler of the Form to change the text displayed on the pnlQ1_1 panel as follows when the program is executed: - Assign the existing text from the panel to a variable - NSC Information Technology - Question 1 - 2018 - Paper 1

Question icon

Question 1

Write-code-in-the-'OnCreate'-event-handler-of-the-Form-to-change-the-text-displayed-on-the-pnlQ1_1-panel-as-follows-when-the-program-is-executed:----Assign-the-existing-text-from-the-panel-to-a-variable-NSC Information Technology-Question 1-2018-Paper 1.png

Write code in the 'OnCreate' event handler of the Form to change the text displayed on the pnlQ1_1 panel as follows when the program is executed: - Assign the exist... show full transcript

Worked Solution & Example Answer:Write code in the 'OnCreate' event handler of the Form to change the text displayed on the pnlQ1_1 panel as follows when the program is executed: - Assign the existing text from the panel to a variable - NSC Information Technology - Question 1 - 2018 - Paper 1

Step 1

Assign the existing text from the panel to a variable.

96%

114 rated

Answer

First, retrieve the current text from the pnlQ1_1 panel and assign it to a variable, say existingText:

string existingText = pnlQ1_1.Text;

Step 2

Add a dash ('-') and use the relevant function to also add the system date to the text.

99%

104 rated

Answer

Concatenate the dash and the system date to the existing text. You can use the DateTime.Now function to get the current date:

dateString = DateTime.Now.ToString("yyyy/MM/dd");
string updatedText = existingText + " - " + dateString;

Step 3

Change the text to upper case and display the text in bold.

96%

101 rated

Answer

Convert the updatedText to upper case and set the modified text as bold:

string finalText = updatedText.ToUpper();
// Assume pnlQ1_1 has a property to set font style to bold
pnlQ1_1.Font.Bold = true;
pnlQ1_1.Text = finalText;

Join the NSC students using SimpleStudy...

97% of Students

Report Improved Results

98% of Students

Recommend to friends

100,000+

Students Supported

1 Million+

Questions answered

;