1. Home
  2. Computing & Technology
  3. Visual Basic

Chapter 4 - Working With Menus and Dialog Boxes - Part 3

By , About.com Guide

4 of 10

The Music Trivia Solution Code - Page 3

Private Sub Button3_Click( _
  ByVal sender As System.Object, _
  ByVal e As System.EventArgs) _
  Handles Button3.Click
  Randomize()
  IndexValue = Int((Rnd() * 3) + 1)
  Debug.Write("IndexValue:" & CStr(IndexValue) & vbCrLf)
  If IndexValue = 1 Then
    Label1.Text = _
      "How do you make a cello sound beautiful?"
    RadioButton1.Text = _
      "Play ""Far, Far Away"""
    RadioButton2.Text = _
      "Sell it and buy a violin"
    RadioButton3.Text = _
      "Play it during the ""1812 Overture"""
  End If
  If IndexValue = 2 Then
    Label1.Text = _
      "How do you fix a broken tuba?"
    RadioButton1.Text = _
      "With a tuba glue"
    RadioButton2.Text = _
      "How do you tell it's broken?"
    RadioButton3.Text = _
      "Who would want to fix it?"
  End If
Explore Visual Basic
By Category
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Visual Basic
  4. Learn VB.NET
  5. Working With Menus and Dialog Boxes - Part 3

©2009 About.com, a part of The New York Times Company.

All rights reserved.