Results 1 to 6 of 6

Thread: Classes -- Project message boxes

Hybrid View

  1. #1

    Thread Starter
    Lively Member GTDriver's Avatar
    Join Date
    Apr 2015
    Location
    Blighty
    Posts
    66

    Classes -- Project message boxes

    Hi guys

    I'm trying to improve my class-making skills... so humor me if you think this is the wrong approach. I have a project that uses several message boxes. Currently, i have these message boxes written into modules and have duplicate instances dotted around. What i want to do is write a class or set of classes that will make my project more efficients and easier to maintain - essentially one message box class (or set of classes) which would replace all my seperate module-level instances.

    Ok so a typical message box comprises (excuse the terminology) the body of text, the title, the click type (ie OK, yes/no, etc), and the alert message (ie 'Warning!', 'Question', etc.).

    Within my project, lets say i use the following text as the body:
    "This is the end of the list"
    "This is the start of the list"

    i have the following titles:
    "Ooops!"
    "Argh!"

    I use the following click types:
    OK
    Yes/No

    And finally, the following alerts:
    Warning!
    Stop!

    Could anyone give me an example of a class/classes that would alow me to call the desired message box from a module based on the combination in need?

    Please give me a shout if i'm not making sense - any and all help appreciated.

  2. #2
    Hyperactive Member
    Join Date
    Feb 2009
    Posts
    258

    Re: Classes -- Project message boxes

    Not sure why this is necessary, unless I'm not getting the gist. Unless you're looking for the ability to name specific text boxes (text, title, and buttons) and call them using the name. Then it's a simple enum type passed into a function that does the proper call to MessageBox. I'm not seeing the need for a class at all, here... at most a single function Am I misunderstanding? Unless you want a class containing various functions, CallEndOfListTextbox(), CallStartofListTextbox(), CallADifferentTextbox(), CallAnotherDifferentTextBox(), and so forth. Yeah, you can do that, but I fail to see what it buys you over a simpler and more standard approach.

  3. #3

    Thread Starter
    Lively Member GTDriver's Avatar
    Join Date
    Apr 2015
    Location
    Blighty
    Posts
    66

    Re: Classes -- Project message boxes

    Quote Originally Posted by HongKongCV View Post
    Not sure why this is necessary, unless I'm not getting the gist. Unless you're looking for the ability to name specific text boxes (text, title, and buttons) and call them using the name. Then it's a simple enum type passed into a function that does the proper call to MessageBox. I'm not seeing the need for a class at all, here... at most a single function Am I misunderstanding? Unless you want a class containing various functions, CallEndOfListTextbox(), CallStartofListTextbox(), CallADifferentTextbox(), CallAnotherDifferentTextBox(), and so forth. Yeah, you can do that, but I fail to see what it buys you over a simpler and more standard approach.
    Like most of my questions... this is down to inexperience - so thanks for your input . I'll look into using enums.

  4. #4
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    Re: Classes -- Project message boxes

    This feels suspiciously like a homework definition? There happens to be a MessageBox class already defined. Perhaps you should look at it for inspiration?
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

  5. #5

    Thread Starter
    Lively Member GTDriver's Avatar
    Join Date
    Apr 2015
    Location
    Blighty
    Posts
    66

    Re: Classes -- Project message boxes

    Quote Originally Posted by Sitten Spynne View Post
    This feels suspiciously like a homework definition? There happens to be a MessageBox class already defined. Perhaps you should look at it for inspiration?
    Not very helpful... but thanks anyway.

  6. #6
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    Re: Classes -- Project message boxes

    Quote Originally Posted by GTDriver View Post
    Not very helpful... but thanks anyway.
    Then be more specific? Did you take a good look? It's a class that seems to do everything you asked about, and if you piggyback its design you'd be close to implementing it yourself. What is lacking?
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

Tags for this Thread

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