Results 1 to 7 of 7

Thread: MessageBox Question

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2006
    Posts
    41

    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!

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2006
    Posts
    41

    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.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Member
    Join Date
    Jul 2006
    Posts
    41

    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());
                }

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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
  •  



Click Here to Expand Forum to Full Width