[RESOLVED] Advice needed for a message box if not enough data entered. - Page 2-VBForums
Page 2 of 2 FirstFirst 12
Results 41 to 48 of 48

Thread: [RESOLVED] Advice needed for a message box if not enough data entered.

  1. #41
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    4,009

    Re: [RESOLVED] Advice needed for a message box if not enough data entered.

    Did you manage to solve your issue? Since you are a beginner i would just point out two thing's with the function you are using. Unless you plan on using it else where in your project it should be private. Nothing else has any business knowing it exists. The second issue is this line
    Code:
    If IsDataEnough() = True Then
    IsdataEnough is a Boolean. You are comparing this to true twice.
    Code:
    If IsDataEnough() Then
    It's also worth saying i would strongly suggest using the validating event of each textbox. When you are ready then call Me.ValidateChildren()

    I find looping the textbox controls a really messy way of validating the values.

  2. #42
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    3,646

    Re: [RESOLVED] Advice needed for a message box if not enough data entered.

    Quote Originally Posted by ident View Post
    The second issue is this line
    Code:
    If IsDataEnough() = True Then
    IsdataEnough is a Boolean. You are comparing this to true twice.
    Code:
    If IsDataEnough() Then
    I'd be surprised if the compiler reads that line of code any differently tho, the VB.net compiler can't be that stupid, can it?

  3. #43

    Thread Starter
    Member
    Join Date
    Feb 2012
    Posts
    56

    Re: [RESOLVED] Advice needed for a message box if not enough data entered.

    Ident, thanks for the tips, much appreciated.

    Incidentals, plenty of hair to pull, but it's all grey. I may PM you, but I don't want to be a pain in the backside. It is my very first project, unfortunately I found some of this code on the web, written by a person who never actually got it to work, he had all the Pythagoras coding wrong, it took me two weeks to figure it out, but I was delighted when I did. But, as you are now aware, it is time to put in tests and message boxes, which for me, is proving a difficult task. But I will continue on.

    Steve.

  4. #44
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    4,009

    Re: [RESOLVED] Advice needed for a message box if not enough data entered.

    Quote Originally Posted by Edgemeal View Post
    I'd be surprised if the compiler reads that line of code any differently tho, the VB.net compiler can't be that stupid, can it?
    I'd be interested in knowing but from what i was taught so can only go by that, the compiler read's If (express = true) = true. regardless it add's more noise to your code.

  5. #45
    Frenzied Member
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    1,695

    Re: [RESOLVED] Advice needed for a message box if not enough data entered.

    @SteveHeather

    I have created my implementation for right triangle calculator check it out, you are free to improve it as you wish.

  6. #46

    Thread Starter
    Member
    Join Date
    Feb 2012
    Posts
    56

    Re: [RESOLVED] Advice needed for a message box if not enough data entered.

    Quote Originally Posted by 4x2y View Post
    @SteveHeather

    I have created my implementation for right triangle calculator check it out, you are free to improve it as you wish.
    Yes I like it very much, it has certainly shown me how to improve on my one, this example will help me out a lot, thanks 4x2y.

    Edit: I have noticed that you have achieved all this without having to use Pythagoras Theorem, that it is good also, it cuts out a lot of code. You have used Pythagoras as a way of checking that the three sides make a right-angled triangle. Great way of doing it.
    Last edited by SteveHeather; Feb 20th, 2012 at 05:55 AM.

  7. #47
    Frenzied Member
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    1,695

    Re: [RESOLVED] Advice needed for a message box if not enough data entered.

    Quote Originally Posted by SteveHeather View Post
    Yes I like it very much, it has certainly shown me how to improve on my one, this example will help me out a lot, thanks 4x2y.
    To simplified the code, i didn't implement heavy checks on entered data, but you can do to make it super intelligent e.g. show a separate warning message for
    If the user input sideA or sideB >= sideC as it is impossible in right triangle
    If the user input 0 on any field
    If the user input negative on any field
    If the user input letters on any field
    etc...


    Quote Originally Posted by SteveHeather View Post
    Edit: I have noticed that you have achieved all this without having to use Pythagoras Theorem, that it is good also, it cuts out a lot of code.
    I worked on this code with a lot of pleasure as it is refresh my memory and back me to high school days

  8. #48

    Thread Starter
    Member
    Join Date
    Feb 2012
    Posts
    56

    Re: [RESOLVED] Advice needed for a message box if not enough data entered.

    Quote Originally Posted by 4x2y View Post
    I worked on this code with a lot of pleasure as it is refresh my memory and back me to high school days
    Well that is good then, but it will help me in future projects, I can learn a lot from examples like yours.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.