473,405 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

How do you use the timer to move the text objects around a board onto textboxes?

Every time the timer clicks it should show a text letter like (T) for tortoise and (H) for hare that moves around the board when the user hits go on the GUI.
Apr 2 '13 #1
12 2178
r035198x
13,262 8TB
Start by learning how to use a Timer http://msdn.microsoft.com/en-us/libr...ers.timer.aspx
Apr 2 '13 #2
I already read up on the timer class.
Apr 2 '13 #3
r035198x
13,262 8TB
So what code have you tried and where are you stuck with it?
Apr 2 '13 #4
So I hit the go button on the user design it starts to fire off the ticks and I am not sure how to move the 'T' or 'H' around the game board. I labeled all 1 hundred text-boxes pos1 thru pos100. I think I need a for loop with an array, and this will be inside the event of the ticking. I am stuck there. Any advice please?
Apr 2 '13 #5
Rabbit
12,516 Expert Mod 8TB
Why do you have a grid of textboxes instead of moving the position of the text box?
Apr 2 '13 #6
The textboxes are just set on the windows form to make the layout of the gameboard. The letter 'T' or 'H' needs to jump from each text box to the next one until it reaches the finish line which would be textbox 100
Apr 2 '13 #7
Is this even possible to do?
Apr 2 '13 #8
Rabbit
12,516 Expert Mod 8TB
Of course it's possible. You just need to keep track of the current location and change the value to the new location on each tick of the timer.

For example, to move it from one textbox to another, you could do something like this:
Expand|Select|Wrap|Line Numbers
  1. Txt1.Text = "";
  2. Txt2.Text = "H";
Of cource, you wouldn't explicitly specify the control in your code. But rather you would keep track of the current one and use the Form's Controls collection to access the current one and next one.
Apr 2 '13 #9
Yeah but how do you say;

Expand|Select|Wrap|Line Numbers
  1. for (i = 0; i < 100; i++)
  2. {
  3. textbox[i].Text = "H"  // Error this is!!
  4. }
Apr 2 '13 #10
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code.

First of all, you wouldn't use a loop, no need to if you keep track of it's current location.

Second, I said that to dynamically reference a control, you would need to use the controls collection of the form object. You can't access it that way, it doesn't work.
Apr 2 '13 #11
For sure code tags, got it.

The forms control and collection. See if I can find that.
Apr 2 '13 #12
Rabbit
12,516 Expert Mod 8TB
Basically:
Expand|Select|Wrap|Line Numbers
  1. formObject.Controls("control name")
Apr 3 '13 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Piotr | last post by:
I need a VBA macro to copy all text from text objects in the igrafx flowcharter Diagram to clipboard or to save it to a text file (in order to count the text I translated). I tried the...
3
by: Xerxes | last post by:
Hi, I need help in setting up a page where the text wraps around an image. Right now, I am using table, with text in one <td> and the image in the adjacent <td>. The problem is when the text is...
1
by: Aaron | last post by:
I'm using relative positioning to move a right-floated image 10px upwards.. Text wrapping around the image should go underneath it once it reaches the bottom of the image, yet it acts as if the...
0
by: JK | last post by:
Hi does anyone know how to compare two text objects (in this case 2 different fields in SQL Server records) and show the differences like SourceSafe. In other words the two files/ fields are...
1
by: Niall Linden | last post by:
Is there any way to move text over an AVI or shockwave object. i have put each one in its own <div> and can move them around and over each other. when i have text on text or on pictures its fine....
6
by: chris.dannemiller | last post by:
I need to be able to move a few form abouts around after a event occurs but when I do this it causes massive flickering is there any way to reduce this?
2
by: zahirbar | last post by:
Hi, I have an image with a basically a big round circle (a photo). How do i make the text wrap around it fully? I use dreamweaver. Thanks
1
by: maya | last post by:
hi, I have to do a page where there's a paragraph with an img on top left and the text in paragr has to wrap around the image.. pls see screen-shot here......
14
by: Zhang Weiwu | last post by:
Hello. I have been using word processor like OOO for nearly 10 years and such layout is very usual to me: gopher://sdf.lonestar.org/I/users/weiwu/ooo_wrap_correctly.png but I found it's very...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.