I was wondering if anyone can help me with this code. I need a code that uses the MessageBox.Show("LALLAA 1"); code but more than of it and in each the number increases by 1 until it gets to the number specified. Thanks!
Printable View
I was wondering if anyone can help me with this code. I need a code that uses the MessageBox.Show("LALLAA 1"); code but more than of it and in each the number increases by 1 until it gets to the number specified. Thanks!
That would be a For loop where you concatenate the loop counter with the base string. You know how to show a message box. Do you know how to join two strings? Do you know how to convert a number to a string? Do you know how to write a For loop?
Well, if I did, I wouldn't really bother asking would I.. While I'm asking and typing this post, I am trying to find it myself. But I hope you can help me beforehand. Thanks in advanced.
The fact that you can't or didn't know how to put them all together doesn't mean you don't know how to do each one individually. That's why I asked. To convert a number to a string you just call its ToString method. To concatenate two strings you just use the '+' operator, like addition for strings. As for the For loop, you've got to have some fun yourself. ;)
http://msdn2.microsoft.com/en-us/library/ch45axte.aspx
Thanks man I got it. To be honest, I hated you because you always give me a paragraph instead of the actual code. I guess you its either your a b*tach or you are actually helping me learn. I think its you wanting me to actually learn. Well, I got it and it seems to work fine for me. Heres the code:
Code:for (int i = 1; i < 10; i++)
{
MessageBox.Show("LLALALAA " + i.ToString());
}
I do tend to prefer giving instructions rather than code because with instructions you have to think about what you're doing and you learn as a result. People can and do learn from code examples but too often they just copy and paste and don't really understand what the code does.
Having said that, I'm not really a very likable person anyway. That's not a misspelling of lickable either.
Take it from me, the misspelling isn't far from the truth either.