I am creating a simple program where a character (Picture Box) is moved using the arrow keys through adjusting the x and y. I have figured out how to detect key presses and adjust the x and y, but I cannot figure out how to redraw the picture box so that it moves. I have used Google but none of the answers are working. Any help is appreciated.

Member Avatar
Member Avatar
+0 forum 2

In C# if you want the thread to pause you would use: [CODE]System.Threading.Thread.Sleep(300);[/CODE] However, I cannot seem to find a C++ equivalent to this? How would I do this, or is it just not possible? Any help is appreciated.

Member Avatar
Member Avatar
+0 forum 3

I need to disable the 2nd item in a comboBox when something happens. How would I go about doing this? Any help is appreciated.

Member Avatar
Member Avatar
+0 forum 3

I created a .txt file with 20 lines of text. I need to read a random line. This code works for the most part: [CODE] Random r = new Random(); rand = r.Next(0,20); //rand is a predefined variable StreamReader reader = new StreamReader("Answers.txt"); answer = reader.ReadLine(); string strAllFile = reader.ReadToEnd().Replace("\r\n", "\n").Replace("\n\r", "\n"); string[] arrLines = strAllFile.Split(new char[] { '\n' }); answer = arrLines[rand]; reader.Close(); [/CODE] Everything works except for occasionally I will get an error that "The index is outsides the bound of the array." Every other part of the code works. Can anyone find the issue? I believe it …

Member Avatar
Member Avatar
+0 forum 4

I use a Form to gather Input from the user, and my program needs to format the info and show it in a Text Box. Everything works except 2 of my variables need to look like this in the output: "variable". The problem is that I can't find a way to make the variable write with quotations around it. Is there a simple solution to my issue, or am I going to have to find a way around using quotations?

Member Avatar
Member Avatar
+0 forum 4

I am building a simple program with 3 Forms. The first Form has 2 Buttons and the other 2 are blank. I used this code: [CODE] public partial class Form1 : Form { public Form1() { InitializeComponent(); button2.Click +=new EventHandler(button2_Click); button1.Click +=new EventHandler(button1_Click); } private void button2_Click(object sender, EventArgs e) { Form3 a = new Form3(); a.Show(); } private void button1_Click(object sender, EventArgs e) { Form2 b = new Form2(); b.Show(); } } [/CODE] When Button 1 is clicked, Form 2 should open. And when Button 3 is clicked Form 3 should Open. Although the forms open when the button …

Member Avatar
Member Avatar
+0 forum 2

I am creating a game that requires me to change the background color of a panel, wait 1 second, then change it back. The code I tried was: [CODE] button1.BackColor = Color.Blue; System.Threading.Thread.Sleep(1000); button1.BackColor = Color.DimGray; //Dim Gray is the original color [/CODE] When I use this code it never switches to blue, it just stays the Dim Gray. I also tried overlaying another Panel colored blue over every panel and setting visibility to false. I then used: [CODE] button18.Visible = true; System.Threading.Thread.Sleep(1000); button18.Visible = false; [/CODE] Again I got the same result, the panel just stayed Dim Gray. Any …

Member Avatar
Member Avatar
+0 forum 4

I am using Visual Studio 2010 Express Edition, and I am developing a basic game application. It involves a New Game button that is clearly named "NewGame" in 'Form1.cs'. But when I use this code: [CODE]NewGame.Click += new EventHandler(newGame);[/CODE] in 'Program.cs' I get the error message "Error 1 - The name 'NewGame' does not exist in the current context". Any help is appreciated, thanks in advance.

Member Avatar
Member Avatar
+0 forum 5

The End.