Visual Basic 2010 Slot Machine Code

-->

To use the functionality of Windows Media Player 9 Series or later in a Visual Basic .NET application, first add the component to a form as described in Using the Windows Media Player Control with Microsoft Visual Studio

This section describes how to create an application that plays video and has custom play and stop buttons.

Add the Video Window

Add the Windows Media Player control to a form. Resize the control, and then place it where you want the video window to appear.

Select the Windows Media Player control, then change the uiMode property to 'none'. This setting hides the UI controls. When the user plays a video, it will appear in the window. For audio-only content, a visualization will appear.

Ok now im going to tell you how to use the program in visual basic click file then make project1.exe save it to your desktop if there are any errors leave a comment and i will try to help you now go to where you made the program and double click it twice and two programs should pop up on one click host and on the other click connect and on the.

Add Two Buttons and Adjust the Form

Visual Basics Codes

Now add two buttons to the form. Select the first button and change the Text property to 'Play'. Select the second button and change its Text property to 'Stop'.

Add the Play Code

Double-click the Play button to reveal the Code window. The following code is displayed:

Add this line to the subroutine:

  • Playing Sounds (Visual Basic); 2 minutes to read +4; In this article. The My.Computer.Audio object provides methods for playing sounds. Background playing lets the application execute other code while the sound plays.
  • Make A Jackpot Appear For Slot Machine May 28, 2012. Im doing an assignment and need help to make a jackpot appear for my slot machine. My code so far is for everything excluding jackpot.code View 5 Replies Make A Slot Machine Program? I'm trying to make a slot machine program.

In the preceding code example, 'axWindowsMediaPlayer1' is the default name of the Windows Media Player control and 'c:mediafile.wmv' is a placeholder for the name of the media you want to play.

If you have added the digital media content from the Windows Media Player SDK to the library in Windows Media Player, you can use this code instead:

2010

Because the autoStart property is true by default, Windows Media Player will start playing when you set the currentPlaylist or URL property.

Add the Stop Code

Slot

Double-click the Stop button to reveal the Code window. The following code is displayed:

Add this line to the subroutine:

Visual basic programs with codes

Note

The managed-code wrapper for the Windows Media Player control exposes the Controls object as Ctlcontrols to avoid collision with the Controls property inherited from System.Windows.Forms.Control.

Add Error-handling

The Windows Media Player control does not raise an exception when it encounters an error such as an invalid URL. Instead, the control signals an event. Your application should handle error events sent by the Player.

Visual Basic Programs With Codes

To create an event handler, open the code window for your form class. From the drop-down list at the top of the window, select the Windows Media Player control. A list of events appears in the drop-down list to the right. From that list, select MediaError. The following code is displayed:

The following code could be inserted in the subroutine to provide minimal error-handling capability. Note that information about the error can be retrieved from the _WMPOCXEvents_MediaErrorEvent argument.

Related topics

I'm suppose to create a Slot Machine game. The user starts with 100 tokens. With each 'pull', the user loses 1 token and the computer 'spins' three wheels, each consisting of the numbers 1, 2, 3.If all are 1, the user gets 4 tokens; If all are 2, the user gets 8 token; IF all are 3, the user gets 12 tokens. The number of tokens that the user has should display on the form and the result of the spin should be display in a message box. This is my code so far:

Visual Basic Code Samples

I don't know how to keep the count of the number of tokens, and have the messages display when a set of numbers are the same. Can you tell me what I'm missing or what I need to include? I just need HELP!!! (lol)

  • 4 Contributors
  • forum7 Replies
  • 1,065 Views
  • 1 Week Discussion Span
  • commentLatest PostLatest Postby asarchit65

Recommended Answers

O.K I assume you need to put some of your code into a button event which becomes your pull. In ther you need a counter to count the number of pulls. You also need to initialize your number of tokens as:
Dim number as Integer = 100 which is the …

Jump to Post

Well what is the idea of line 7? Maybe you should get rid of it. I thought you want to count the number of puls there consequently my idea of a second counter . In the real world you only get a certain number of pulls.

Jump to Post

All 7 Replies

Visual Basic 2010 Slot Machine Codes

When the same numbers appear on the form, it still says Try Again, how do I get it to say the amount of tokens the user have won?