|
-
Oct 4th, 2006, 10:14 PM
#1
Thread Starter
Member
MessageBox Question
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!
-
Oct 4th, 2006, 10:21 PM
#2
Re: MessageBox Question
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?
-
Oct 4th, 2006, 10:30 PM
#3
Thread Starter
Member
Re: MessageBox Question
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.
-
Oct 4th, 2006, 10:34 PM
#4
Re: MessageBox Question
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
-
Oct 4th, 2006, 11:10 PM
#5
Thread Starter
Member
Re: MessageBox Question
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());
}
-
Oct 4th, 2006, 11:32 PM
#6
Re: MessageBox Question
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.
-
Oct 5th, 2006, 04:25 PM
#7
Re: MessageBox Question
Take it from me, the misspelling isn't far from the truth either.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|