Moves To A Random Location Everytime?
Oct 14, 2009I'm trying to make this game, where the button moves to a random location everytime your mouse gets near it.How would i do it?
View 3 RepliesI'm trying to make this game, where the button moves to a random location everytime your mouse gets near it.How would i do it?
View 3 RepliesI have a Application that uses proxy IPs. I have a List of 100 ips, adn i want to take a random proxy and use that each and everytime whenever a button is clicked. I got the Proxy code and i modified it as below.
Imports System.IO
Public Class form1
' The structure we use for the information
' to be interpreted correctly by API.
[code]....
It successfully give random results but when i use webbrowser to confirm proxy ip, it shows only 1st or 2nd ip for every time. but i am getting random ips in listbox. When i click button it will get random ip and make browser to navigate to that ip and later it will add it to listbox.
I've got a global random type variable, let's call it rRandom.In my code, I generate a random number like below:
Dim iRandom As Integer = rRandom.Next(0, x)
9 out of 10 times iRandom is 0, the other time it was 1. The code isn't on a timer, it happens when I do something (say clicking a button), so the frequency of the code being called is about 2-3 seconds, I say this because I've had similar issues when generating random numbers really fast in a timer, or with a for loop IIRC.X is a variable that, presently, starts at 3, and will decrease until 0, in which it'll return back to 3. Obviously, if X is 0, iRandom will be 0, but it shouldn't be 0 all the time.I'm declaring the variable globally because I remember, again, having similar issues using local variables, idk whether I should be or not.
How can i get form2 to to load exactly center of form1 or a location within the form when i get form2 to show, no matter the location of form1.[code]...
View 10 RepliesI have a problem that I can not seem to get. I have a program that moves a picture to what ever location the user puts into the text boxes. It works as I wanted it to but my problem is when a user puts in anything but a number into the text box it gives an error, I want a message to pop up and let them know that a numbers needs to be entered not a text.
View 6 RepliesI am practicing using the drawing commands, and have gotten a grass background and black happy face that moves around the background.It's a 10x10 grid of 50 pixels.I want (at the moment, when i press enter) it to generate a random number of trees (15 ~ 25) at random locations on the background. The program doesn't freak out about anything, and the variables seem to be right (using stop commands) but it's not drawing anything. Here is the code for the "GenerateTrees" command I have for when I press enter.
Private Sub GenerateTrees()
NumberOfTrees = Int(Rnd() * 10) + 15
For i = 0 To NumberOfTrees - 1
bmap.MakeTransparent(Color.Fuchsia)
[code].....
I want to load a picturebox and it gets a random location on the screen.How do I do that?
View 3 RepliesI am a grade 11 student in high school and am struggling with a project in my computer programing class. in the project we are to create a mario game, where you have 2 pictureboxes (the player and the enemy) one picturebox, the player, is moved using the keypad, the goomba isn't moved at all. the object of the game is to 'kill' as many goombas as quick as possible. I need to make the game so that if the boundries of the player intersect witht he boundries of the goomba, the goomba will move to a random location.
I can't get the goomba to move to a random location, here is my code. I highlited and bolded the part of the code that I am having the prolem with.
Public Class FrmQ4
Dim intLocation As Integer
Dim intCounter As Integer
[Code].....
im working on a little project and i need my form1 to basically spam itself in random locations...
View 5 RepliesI 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'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.
This is the code I am working with...
[Code]...
im loading images into 2 picturebox controls My app works as it should but i need to know when i should dispose of the images or does the garbage collector do it for me?on a user click the images change, i think that my app will become resource hungry and cause the app to bomb out at some point.So do i use Picturebox1.dispose() each time new images are loaded into the pictureboxs to free up the image from memory?
View 5 RepliesHow do I create a Javascript method in here that RELOADS the .aspx page, that I can call during one of those other existing methods.[code]...
View 2 RepliesI have a multiline label that im trying to add a line everytime I click the button. Its basically adding a new CD track name, CD minutes, and CD seconds to each new line for everytime the user inputs the given information:
1 Track_Name1 3 min. 13 sec.
2 Track_Name2 2 min. 34 sec.
3 Track_Name3 3 min. 01 sec.
.
.
.
But it keeps adding the "new" line in the position of the old one, so its only displaying on 1 line. I tried using a vbCrLf, but I might have it in the wrong spot?
heres what I got...
Private Sub btnAddCut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddCut.Click
cutCounter += 1
[Code]...
The cutCounter is obviously the track number, and it clears the current info for the new information.
in my vb.net windows application i have crystal reports implementedfor making it work properly after deploying on client side i have
the below code
End
With
[code].....
see the pic. and advise why this error is coming up and how to fix it.
View 1 Replieschange the program flow- so that it ignores certain precedures.Functionality: a form that displays all users. Optionally a user could check a check box and it would display his age. beside it Program Precedure: Now, I have to recheck everytime if it is checked. Is there a way to make the program just ignore a certain line of code(or something, that whatever it is I can't name). And I'm asking that the program should run without any evaluation whatsever?
View 7 RepliesImports System.Data.SqlClient
Imports System
Imports System.Data
[Code].....
Is there a way to call a function everytime it throws an error? I could use try catch, but I need to do it with unexpected errors.
View 8 RepliesI have tried to test out the add delete and save function on a datagridview but the data that I added during testing would disappear after I made some changes to the code.
View 3 RepliesPossible Duplicate: Get year and month from SQL .I want to know that everytime I change the month the tracking number will start at 001 ..For example this is my tracking number:
CAB1108072 == CAB + 11 for year, 08 for month of august, 072 running number
Do I need to have another column in the table for the month in order to generate the tracking number everytime the month changes? The output should be like this.Example:
August 31, 2011 running number is 072 tomorrow is september 1st i need the tracking number start to 001, because september is another[code]....
How to fix the error in code..this code will always display msg box if user select ot nt slect the checkbox .. but i want if user doesn't select any of the checkbox or forgot to select checkbox then msg box will ppear other wise redirect to other page ..
[Code]....
How can I make a form with a new webbrowser control on it everytime?
View 2 RepliesI made a program that makes backups of a database when the user runs the application, etc. I never created something like this. I got all the code to make the backup, now the problem is to create it as a service.This is my form to the person choose the days and the hour to the process runs and install it as a service, and when it runs to be minimizated on the windows icons near clock and date and another option.
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
AddToStartup()
End Sub
Public Sub AddToStartup()
Dim Reg As Object
[code]....
I got this code to creates a short cut on the startup path to my project run Every time windows start's and do his job and close, but now I got a problem, how It should be to VB2010 ? And how it would make a run on the specific days / hour that persons choose ?
I have a program that everytime it is started download a file, read to a list, and add an entry to that list.That entry will be the useres ip address. I have gotten that far so far, but the ip address is sometimes the ip address of the lan like 192.168.1.100. That will nto work properly. I want the true ip address like 69.47.192.12
View 2 RepliesI'm updating a database every few minutes in my program but I get this error
Duplicate entry '127' for key 1
Everytime the db row Id reaches 127.
i am using an unbound datagridview so i can dynamiclly add rows. all that is working fine. but the grid is not is the location i have coded.. i am using the defualt form as a base then coding the unbound stuff in.. should i just create a blank class file and do everything? the only problem i am having is the grid must bees in the correct location according to the pixel point that i have given it. Right now it is placing the grid at point (0,0) no matter what point is entered on the line for location. so what am i missing??????
View 3 RepliesI got a error when I run this code:
Dim btch As String
Dim LeftPart As String
[CODE]...
It says index and location must refert to a location withing string
dim cn as oledbconnection
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:valid.mdb")
[code]......