Question

visual basic write a program that requires a name and calls a sub procedure to display...

visual basic write a program that requires a name and calls a sub procedure to display the birthday song with the name inserted into the song

0 0
Add a comment Improve this question Transcribed image text
Answer #1

EXPLAIN

HERE THE PROGRAM IS DONE WITH VISUAL BASIC(AS PER QUESTION) WITH VB 6.0 APPLICATION.

IN PART 1 THE BIRTHDAY SONG WITH THE NAME IS DISPLAYED THROUGH MESSAGE BOX

IT CAN BE DISPLAYED THROUGH LABEL ALSO. THE CODE IS GIVEN IN PART 2.

PART 1.

Private Sub Command1_Click()
' call sub procedure birthday_display
Call birthday_display(Text1.Text)
Text1.Text = ""
End Sub

'define sub procedure
Sub birthday_display(ByVal b_name As String)
Dim song As String
' store the entire song in song string
song = "Happy Birthday to You" & vbNewLine
song = song + "Happy Birthday to You" & vbNewLine
' insert the name with string b_name in the song
song = song + "Happy Birthday Dear " & b_name & vbNewLine
song = song + "Happy Birthday to You "
'here the birthday song is displayed through message box
MsgBox song, , "happy birthday song"
End Sub

SCREEN SHOT

OUTPUT

PART 2

Private Sub Command1_Click()
' call sub procedure birthday_display
Call birthday_display(Text1.Text)
Text1.Text = ""
End Sub

'define sub procedure
Sub birthday_display(ByVal b_name As String)
Dim song As String
' store the entire song in song string
song = "Happy Birthday to You" & vbNewLine
song = song + "Happy Birthday to You" & vbNewLine
' insert the name with string b_name in the song
song = song + "Happy Birthday Dear " & b_name & vbNewLine
song = song + "Happy Birthday to You "
'here the birthday song is displayed through label
Label2.Caption = song
End Sub

SCREEN SHOT

OUTPUT


Add a comment
Know the answer?
Add Answer to:
visual basic write a program that requires a name and calls a sub procedure to display...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT