Results 1 to 5 of 5

Thread: Messagebox

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    7

    Messagebox

    Hello!! VB.NET 2003
    I am so new at this it isn't funny. I am right now programming a fun little test that people take in order to find out their life expectancy. Any how it is a 3 page application and before the user clicks the "Next Page" button I want the program to catch any questions that haven't been answered.

    The questions are asked and then the user fills in 1 of 2 radio buttons that are grouped together by the panel control.

    What I want is instead of having multiple boxes pop up when the user forgets to answer more than one question, I want only one box that states "You have not answered Question#: 1, 5, and 10. You need to answer these before moving on to the next page" And I don't want the user to be able to go to the next page until these fields have been filled in. Down below I will put what I have if someone could help me out I would be so greatful Thanks!!! PS... as it stands my code won't even let me get to the second page anyways....This can be awfully frustrating


    PrivateSub btnNext_Click(ByVal sender AsObject, ByVal e As System.EventArgs) Handles btnNext.Click
    If mypart1.rdoYes01.Checked = FalseAnd mypart1.rdoNo01.Checked = FalseThen
    MessageBox.Show("Hey!! You need to answer number 1!")
    EndIf
    If mypart1.rdoYes02.Checked = FalseAnd mypart1.rdoNo02.Checked = FalseThen
    MessageBox.Show("Hey!! You need to answer number 2!")
    EndIf
    If mypart1.rdoYes03.Checked = FalseAnd mypart1.rdoNo03.Checked = FalseThen
    MessageBox.Show("Hey!! You need to answer number 3!")
    EndIf
    If mypart1.rdoYes04.Checked = FalseAnd mypart1.rdoNo04.Checked = FalseThen
    MessageBox.Show("Hey!! You need to answer number 4!")
    EndIf
    If mypart1.rdoYes05.Checked = FalseAnd mypart1.rdoNo05.Checked = FalseThen
    MessageBox.Show("Hey!! You need to answer number 5!")
    EndIf
    If mypart1.rdoYes06.Checked = FalseAnd mypart1.rdoNo06.Checked = FalseThen
    MessageBox.Show("Hey!! You need to answer number 6!")
    EndIf
    If mypart1.rdoYes07.Checked = FalseAnd mypart1.rdoNo07.Checked = FalseThen
    MessageBox.Show("Hey!! You need to answer number 7!")
    EndIf
    If mypart1.rdoYes08.Checked = FalseAnd mypart1.rdoNo08.Checked = FalseThen
    MessageBox.Show("Hey!! You need to answer number 8!")
    EndIf
    If mypart1.rdoYes09.Checked = FalseAnd mypart1.rdoNo09.Checked = FalseThen
    MessageBox.Show("Hey!! You need to answer number 9!")
    EndIf
    If mypart1.rdoYes10.Checked = FalseAnd mypart1.rdoNo10.Checked = FalseThen
    MessageBox.Show("Hey!! You need to answer number 10!")
    EndIf
    ExitSub
    mypart2 = New part2
    mypart2.Show()
    mypart1.Hide()
    EndSub
    Last edited by jenok2000; Apr 9th, 2006 at 04:03 PM.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    105,439

    Re: Messagebox

    It really depends how customised you want the message to be. The simplest way would be to just start with an empty string an append the numbers of any unanswered questions, separated by commas. You would then append that string to another string that says "Hey!! You need to answer numbers " and show that in a message box. You can then customise that so that the last number has "and' before it instead of a comma, and also to use "number" instead of "numbers" if there is only one.

  3. #3
    Fanatic Member -TPM-'s Avatar
    Join Date
    Jul 2005
    Posts
    850

    Re: Messagebox

    You might want to also check out the error provider control as well.
    http://www.startvbdotnet.com/controls/tooltip.aspx
    TPM

    Add yourself to the VBForums Frappr Map!!

  4. #4
    Addicted Member Crushinator's Avatar
    Join Date
    Jan 2006
    Location
    The Dark Side of the Moon, MD
    Posts
    179

    Re: Messagebox

    For your Problem showing the second form, you may want to check out this four part article about using forms in VB.NET 2003:

    Working with Multiple Forms - Article 1

    Article 2

    Article 3

    Article 4

    ~Crush
    Using Framework 2.0, VB.Net 2005.

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    7

    Re: Messagebox

    Thank you so much for your help. All of you. A beginners class/book can only get you so far. It is neat being able to have this out here to learn beyond the scope of the book.

    Crush,
    Those articles are very useful, I read them about a week or more ago and was able to put my knowledge to use with them. The problem is and I did a quick second glance to be sure and I don't think it covered if you were validating. Meaning first you want to complete validation on page one before it lets you get to page two. The problem I am having is, it stops you from going to the next page so the user can complete the validation but it won't let you pass to the second page now at all even if the validation is complete.

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