| | |
Marquee image box
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Mar 2009
Posts: 6
Reputation:
Solved Threads: 0
Hello. I am developing a game and for this game 2 of my sprites appear to be flying to the right. i have acomplished this by allowing an image box with the skay on to scroll accross my form from the right to the left. however, once the image has scrolled off the screen i can not get it to reset it self so that it it can scroll continuously.
back_star = my timer
sky = the image of the sky
This is my code.
please could you take a look and show me where i have gone wrong or any alternative coding.
back_star = my timer
sky = the image of the sky
VB.NET Syntax (Toggle Plain Text)
Private Sub Form_Load() back_star.Enabled = True back_star.Interval = 1 End sub Private Sub back_star_Timer() back_star.Enabled = True If back_star.Enabled = True Then sky.Left = sky.Left - 50 Else If sky.Left <=sky.Left -4920 then sky.Left = sky.Left + 0 End If End If End Sub
This is my code.
please could you take a look and show me where i have gone wrong or any alternative coding.
Last edited by Razza92; Mar 14th, 2009 at 11:20 am. Reason: missed some code
•
•
Join Date: Dec 2002
Posts: 461
Reputation:
Solved Threads: 56
You must be using vb6.
Your timer logic is wrong.
1. when you come into the timer you are setting the timer enable and then checking to see if it is enabled. Which will allways be true.
2. The timer will not fire unless it is enabled which causes the above to happen again.
Try this code.
Your timer logic is wrong.
1. when you come into the timer you are setting the timer enable and then checking to see if it is enabled. Which will allways be true.
2. The timer will not fire unless it is enabled which causes the above to happen again.
Try this code.
VB.NET Syntax (Toggle Plain Text)
Option Explicit Private Sub Form_Load() back_star.Enabled = True back_star.Interval = 1 End Sub Private Sub back_star_Timer() sky.Left = sky.Left - 50 If sky.Left < -sky.Width Then sky.Left = Me.ScaleWidth End If End Sub
Wayne
It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
![]() |
Similar Threads
- Tutorial: Photoshop: create an interface style content box (Graphics and Multimedia)
- Help!! Form Sends Incomplete Data Should Be Required To submit Form (PHP)
- over-ride inaccessable javascript function? (JavaScript / DHTML / AJAX)
- Firefox Compatibility help with script (JavaScript / DHTML / AJAX)
- To align the whole web page in the centre of the page (ASP.NET)
- Photoshop Question (Graphics and Multimedia)
- IPB vs. phpBB (Growing an Online Community)
Other Threads in the VB.NET Forum
- Previous Thread: Problem while Inserting and Updating data into MS access
- Next Thread: Get Files of Recycle Bin
| Thread Tools | Search this Thread |
.net .net2008 2005 2008 access account arithmetic array basic bing browser button buttons center check code combobox component crystalreport cuesent data database datagrid datagridview date datetimepicker dissertation dissertations dissertationtopic dropdownlist excel fade file-dialog filter ftp generatetags google hardcopy images input insert intel internet mobile monitor ms net networking objects output panel passingparameters pdf picturebox picturebox1 port position print printing problem problemwithinstallation project save searchbox searchvb.net select serial settings shutdown soap survey table tcp temperature text textbox timer timespan toolbox transparency trim update updown user vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf year





