Photo AI
Question 1
OnCreate Event [Question 1.1] Write code in the "OnCreate" event handler of the Form to change the text displayed on the pnl01_1 panel as follows when the program is... show full transcript
Step 1
Answer
To begin, you will need to read the heading from the panel and assign it to a variable. This can be done using the following code:
Dim heading As String
heading = pnl01_1.Text
Next, modify the heading by using the relevant string functions:
heading = heading & " - " & Format(Date, "yyyy/mm/dd")
heading = UCase(heading)
pnl01_1.Font.Bold = True
pnl01_1.Text = heading
Step 2
Answer
To set up the button functionality, use the loop to output the characters from Z to R by implementing an unconditional loop:
Dim sOutput As String
Dim cCounter As Integer
sOutput = ""
For cCounter = Asc("Z") To Asc("R") Step -1
sOutput &= Chr(cCounter)
Next
TextBox1.Text = sOutput
Step 3
Answer
To calculate the total number of words:
Dim numPages As Integer
numPages = spinEdit.Value
Dim totalWords As Integer
totalWords = numPages * WordsPerPage
Step 4
Answer
For determining the read time based on the type of book, follow these steps:
Dim timeInMinutes As Integer
If radioLiterature.Checked Then
timeInMinutes = totalWords / (250)
Else
timeInMinutes = totalWords / (75)
End If
editTimeMinutes.Text = timeInMinutes
Step 5
Answer
To handle the password decryption:
Dim password As String
Dim decryptedPassword As String
password = cmb01_4.SelectedItem
decryptedPassword = Mid(password, 3) & Left(password, 2)
If InStr(password, "#") > 0 Then
decryptedPassword = Replace(decryptedPassword, "#", "$&.")
End If
Step 6
Answer
To calculate and display the (x,y) coordinates:
TextBox2.Clear()
TextBox2.Text = "Coordinates" & vbNewLine
Dim x As Integer
x = Val(EditX.Text)
Dim y As Integer
y = 3 * x - 2
TextBox2.Text &= "(x,y) = (" & x & "," & y & ")" & vbNewLine
Do While y > 0
x = x - 2
y = 3 * x - 2
TextBox2.Text &= "(x,y) = (" & x & "," & y & ")" & vbNewLine
Loop
Report Improved Results
Recommend to friends
Students Supported
Questions answered