mercredi 12 mars 2014

help VB topic




can some one tell me whats wrong with this code


Code:


Private Sub btnDisplay_Click( . . . )  Handles btnDisplay. Click
‘Toggle switch from on to off and from off to on.
Dim switchOn As Boolean
switchOn = CBool( InputBox( " Enter True or False. " ,  " The switch is on. " ) )
If switchOn Then
switchOn = False
End If
If Not switchOn Then
switchOn = True
End If
txtOutput. Text = CStr( switchOn)
End Sub


and also


Code:


Private Sub btnDisplay_Click( . . . )  Handles btnDisplay. Click
‘Display twice the length of a word.
Dim word As String
word = InputBox( " Enter your favorite word " )
txtOutput.Text = “When the word is written twice, “ &
                            Twice (word) & “  letters are used.”
End Sub
Function Twice (w As String) As Integer
‘Compute twice the length of a string.
Dim len As Integer
              Return len = 2 * w.Length
End Function







Aucun commentaire:

Enregistrer un commentaire