Tic Tac Toe Game - Place At Random An X Or An O In An Empty Label?
Nov 12, 2009
A fiend of mine and myself are working on a simple game of tic tac toe and we can't for the life of us figure out the computer part. Can you guys help?
What we want to know is, if the label has X or O in it and therefore is occupied then the computer should place at random an X or an O in an empty label.
I have created a scrabble game that generates random letters. For the user to type in a word using the random letters they have to type it in a text box.
I want my program to prevent users from typing in letters that are not provided in the text box and to allow them to type in the random letters that are provided.
[code] I am trying to place random numbers into labels, but the process that i am doing is taking way to long, just wondering if there is an easy way around this? I also need to know the answer to the sums that get placed into the labels and then check that against the answer in the text box.I have looked all over the DIC forums and nothing meets my queries.Please help, this is just a quick program for my son so that he can get some sums into him.
I'm trying to make a Form pop up at an random place (given in a textbox). Here is my code so far:
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick Form2.Location = Textbox1.text Form2.Visible = True End Sub
Yes i know it doesn't work. What I really need to know is how to make the txt understandable for the system.drawing.point.
I have an issue when I place a label box / other component in the MDI Parent form and then open any child form the label box/ other component displayed in child form (Show in SpanShot),
I have a program which moves a label inside the panel in a four direction(up,down,right,left) when i click the relevant button.For this i have used the following code.Its working well. But the thing i want is the label should be placed in the center(0,0) of the panel when the form loads.
vb Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
So basically what I am trying to do is, take the id value of the row that is clicked and place it in a label outside of the gridview, however, when I do this the label come up with no text. I think my problem is that x is not being set to the exact row that is being clicked.
Dim x As String Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then Dim id As Label = CType(e.Row.FindControl("id"), Label) Dim button As Button = CType(e.Row.FindControl("button1"), Button) [Code] .....
I have an assignment that requires me to use a variable from an InputBox and place it on a label. That variable needs to be formatted using the P0 formatstring but results in the folowing error: Error2Option Strict On disallows implicit conversions from 'String' to 'System.IFormatProvider'.
Here's my
Option Explicit On Option Strict On Public Class MainForm
Trying to use icons on my visual basic form but don't know how to place the icon and label so that they are linked and when the are clicked they get highlighted and stuff like the basic desktop icons.
I have done allot so far but now im stuck on this:
1. i have 35 picture boxes on my form
2. i have a folder with 49 images (.png) 7 colors * 7 numbers = 49
3. i have 2 timers 1st set to 3min. second to 2 min.
evrything is good so far what i need to do is when timer 2 starts to start drawing the balls (images) from the folder
It needs to be random and only 1 image each round
I dont get it done sitting 2 days watching youtube videos and googeling about it and still nothing i got it that far that it shows random images but then i get same image 4 or 5 times on the form.
I've been asked to write an age guessing game using vb. We have to have 4 buttons and a text box where the random number is displayed. The range is between 5 and 110. we have a 'too high' 'too low' , 'start' and 'correct' button
Stuck programming a random number generator game. one is to guess what the random number. I have coded most of it and am pleased, but there are some hitches. a) When running the program if you guess 10 it says," Guess Higher" which is impossible as the num gen stops at 10 (if you guess 9 and the number is lower than 9 it says guess lower . . . which it is supposed to do)
b) When asked to play again if one clicks no it calls you a loser and exits the problem is it does the same if you click yes. How can I get it to simply start over if yes is clicked
c) Does anyone know how to make an image move up or down based on the input? IE if guess needs to be higher the image moves higher? Lower and it moves lower?
i am a complete beginner in VB, I need help for a very simple cards game that I am doing. I need to associate a random picture to a Picturebox every time that I click on a button. I can set the visible property to the picture, but it is always the same picture that shows up, and I would like it to be randomly generated instead, (from a series of card pictures that I have in a folder.)
I'm creating a new (or more) tab(s) with a multi-line textbox (filled) at runtime and some text is added. Each time I change/select a (new) tab it needs to search for a string and if found...blablabla.How do I get the control to search in?
im making a random number guessing game type thing, i have the main thing done, but I was just wondering, how could I get it to show the integer rndnumber in the message box that comes up? I think its something like &= or something, but I havn't even been using VB for a week, so im can't figure it out. Here is my script:
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If RadioButton1.Checked = True Then[code]......
I'm trying to teach myself how to create a Random Number Generator in Visual Basic 2008 using a menu system and I'm having difficulty with the following:If I type in a number above 100, I don't get a message appearing saying that the number that I typed is too high.I don't know what I need to code to start a new game.How do I get messages to show up when both pressing the "Check Me" button and using the "Give Me the Number" option to say whether the answer is correct or too high or too low.ful to hear them.
how to eliminate duplicate random numbers displayed in labels ( a column of 5 labels). This is for a BINGO game i am doing. I have tried a Do .. Loop until structure with a for next but i am not sure how to proceed:
Do For NumB = 0 To 4 B(NumB) = Int(15 * Rnd() + 1) itemarrayB(NumB).Text = B(NumB) Next Loop Until
I have a picture box and I tell it to appear on a random location on another specified larger picture box.
here's my code:
Code: Sub P2_AppleMove() Dim P2ax As Integer = CInt(Int((P2Foodarea.Width * Rnd()))) ' sets the random area of the food
[Code]....
P2foodarea is a large picture box I created. I only want the apple to spawn on P2Foodarea, atm, it spawns on P1Foodarea which is very weird. P1foodarea is a whole other picture box. I even made new variables as you can see P2ax and P2ay, but it still doesn't spawn on P2Foodarea. I have even tried recreating a new picture box for P2foodarea
I am using Vb 2010 I am trying to make a matching game. My problem is I have picture boxes 16 to be exact. I want each one to randomly go to a certain place I have already picked on the form. That means that I have 16 places already picked and I have made point variables for all 16. I can not seam to randomize the picture boxes to be placed in only those 16 locations.
How do I go about doing this? I have currently made this code, but sometimes points are created on the boundaries of this picture box, which I do not want. I want all new random points to be within the bounds of this large playarea (picturebox). Foodarea is my big picturebox which i want all fruit to spawn WITHIN not outside on it's edges.
I want to read a random line (that I've chosen via random number) in a text file. I want to the system IO reader. But I am confused as to how to read a random line. Here's what I have...
Im making a text based game that i need to randomly select different numbers of lines from a text file then pass them to a list box. The text file is made in the following format:
First the code needes to identify the 4th element then randomly select lines from lines that contain that element. Im stuck on how to randomly select lines from that list.This is the code i have so far.
I'm trying to teach myself how to create a Random Number Generator in Visual Basic 2008 using a menu system and I'm having difficulty with the following:
If I type in a number above 100, I don't get a message appearing saying that the number that I typed is too high.I don't know what I need to code to start a new game.How do I get messages to show up when both pressing the "Check Me" button and using the "Give Me the Number" option to say whether the answer is correct or too high or too low.[code]...
Below is the code that we have been working on. We have bolded the parts which we are unsure about - they are producing errors. (its near the bottom)The program is designed to generate a random hand of cards out of our list of them. This program is a smaller version of what we hope to have in the full one - ie. It tries to get a random hand of 3 cards out of a possible 5.
The part we are having errors with is getting the images to display on each of the 3 'picturebox' objects using a loop (so we don't have to type each picturebox individually).
i've created a hangman game (Fully working) but since you can only "play" with one phrase (10 letters) it gets boring fast. Basic the current game works by on form load i define the slots (10 string which each hold a letter) and give them there letter. then the user type in a text box and if the textbox = any of the slots then the lbl repasenting that slots changes its text from "_" to the letter.
Anyway what I would like the button to do is when the user presses the start button a random number is generated. The program then looks into a textfile and based on which number is generated it takes a certain line (10 characters per line in a phrase) , moves them into the slots and the game starts. Is that possible to code or it too complicated. The textfile will be in the applications folder (words.txt).
I have 3 label and 1 button and need to create random number in each label after the button is pressed, the numbers don't need to be unique but cant have all 3 labels with the same number, I have looked around the web but can't find the code I am looking for.
I have 25 labels (Label1 - Label25). How can i randomly make the background of 1 label blue?I can set a random number in a variable, but I can't find out what to do next. It has to be something like this:[code]
Public Sub RandomNumbers() Dim s(4) As String Dim RandomNumber As Byte
I don't know if you can tell what I am trying to do here, so I will try to explain. I what to create for random numbers and place them into for different text boxes. I also would like to do this with combo boxes and their selected indexes. So if the combo box has 10 items in it; the new selected index would be the random number generated above.