| | |
Creating a moving button in vb 2005 Help
Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Feb 2009
Posts: 19
Reputation:
Solved Threads: 0
Hi ,
I already created a button "enjoy button" that i want to move in a form when the "timer start button" is clicked.
how do link the timer to the
"timer start button" and make it move?
this is what i tried so far..then am blank
first
then
I already created a button "enjoy button" that i want to move in a form when the "timer start button" is clicked.
how do link the timer to the
"timer start button" and make it move?
this is what i tried so far..then am blank
first
•
•
•
•
Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Me.xTimer.Enabled = False
xTimer.Interval = 10
DX = 1
xDXTextBox.Text = DX
DY = 1
xDYTextBox.Text = DY
Counter = 1000
xCounterTextBox.Text = Counter
X = 216
Y = 135
Me.xButtonLabel.Text = "Button(" & X & ", " & Y & ")"
•
•
•
•
Private Sub TimeStartButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xTimeStartButton.Click
Me.xTimer.Enabled = True
on timer tick event
- make randomize function to get new X and Y,so your button always get new location to moving every timer tick.
- make randomize function to get new X and Y,so your button always get new location to moving every timer tick.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
•
•
Join Date: Feb 2009
Posts: 19
Reputation:
Solved Threads: 0
i got it...i used
but now i want to make the timer stop when i click the timer start button and the button stop moving aswell..how do i do that?
VB.NET Syntax (Toggle Plain Text)
Me.xButtonLabel.Text = "Button(" & xEnjoyButton.Location.X.ToString & ", " & xEnjoyButton.Location.Y.ToString & ")
but now i want to make the timer stop when i click the timer start button and the button stop moving aswell..how do i do that?
•
•
Join Date: Mar 2009
Posts: 44
Reputation:
Solved Threads: 4
Why would you want the timer to stop when you press the button to start the timer? lol. If you put the code to move the button in the timer_tick event, as you should have already, you just need to stop the timer like this.
VB.NET Syntax (Toggle Plain Text)
Private Sub TimeStartButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xTimeStartButton.Click xTimer.Stop() End Sub
Last edited by crazyhorse09; Mar 15th, 2009 at 7:25 pm.
•
•
Join Date: Feb 2009
Posts: 19
Reputation:
Solved Threads: 0
•
•
•
•
Why would you want the timer to stop when you press the button to start the timer? lol. If you put the code to move the button in the timer_tick event, as you should have already, you just need to stop the timer like this.
VB.NET Syntax (Toggle Plain Text)
Private Sub TimeStartButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xTimeStartButton.Click Me.xTimer.Stop() End Sub
•
•
Join Date: Feb 2009
Posts: 19
Reputation:
Solved Threads: 0
but now i want to use the button "start time button" as a switch to turn off and on the ticker if click...first it turns it on then off, etc.
This is what i got to start it
This is what i got to start it
VB.NET Syntax (Toggle Plain Text)
Private Sub TimeStartButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xTimeStartButton.Click If Me.xTimeStartButton.Enabled = True Then Me.xTimer.Start() End If
•
•
Join Date: Mar 2009
Posts: 44
Reputation:
Solved Threads: 4
Ok, then try this in the button click:
P.S. You don't need to keep using all those "Me"s
VB.NET Syntax (Toggle Plain Text)
If xTimer.Enabled = True Then xTimer.Stop() xTimer.Enabled = False ElseIf Timer1.Enabled = False Then xTimer.Enabled = True xTimer.Start() End If
P.S. You don't need to keep using all those "Me"s
Last edited by crazyhorse09; Mar 15th, 2009 at 7:45 pm.
•
•
Join Date: Feb 2009
Posts: 19
Reputation:
Solved Threads: 0
•
•
•
•
Ok, then try this in the button click:
VB.NET Syntax (Toggle Plain Text)
If xTimer.Enabled = True Then xTimer.Stop() xTimer.Enabled = False ElseIf Timer1.Enabled = False Then xTimer.Enabled = True xTimer.Start() End If
P.S. You don't need to keep using all those "Me"s
![]() |
Similar Threads
- Nasty case of Guard.tmp (Viruses, Spyware and other Nasties)
- Ned help with pop up pages (Viruses, Spyware and other Nasties)
- Plz help me (Viruses, Spyware and other Nasties)
Other Threads in the VB.NET Forum
- Previous Thread: Hangman Project
- Next Thread: VB Help
| Thread Tools | Search this Thread |
"crystal .net .net2008 2008 access add advanced application array assignment basic beginner box browser button buttons center click code combo convert cpu cuesent data database datagrid datagridview datetimepicker designer dissertation dissertations dissertationtopic dosconsolevb.net editvb.net employees excel exists firewall forms html images isnumericfuntioncall listview map math memory mobile module msaccess mssqlbackend mysql navigate net number opacity open pan pdf picturebox picturebox2 port position print printpreview record regex reuse right-to-left save search serial settings socket sorting sqldatbase sqlserver storedprocedure temp textbox timer timespan transparency txttoxmlconverter useraccounts usercontol vb vb.net vb.nettoolboxvisualbasic2008sidebar vba vbnet vista visual visualbasic visualbasic.net visualstudio.net web wpf wrapingcode xml year






