Results 1 to 5 of 5

Thread: Visual Basics

  1. #1
    Join Date
    Aug 2005
    Posts
    174
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Visual Basics

    Hey

    I'm trying to reduce the amount of duplicate code in my program. I have a global module with the code:
    Code:
        Public Sub workDiscount()
            'Discounts
            If Form1.radStu.Checked = True Then
                dblDiscount = ((screencost / 100) * 15)
            End If
    
            If Form1.radOAP.Checked = True Then
                dblDiscount = ((screencost / 100) * 20)
            End If
    
            If Form1.radNoDiscount.Checked = True Then
                dblDiscount = 0
            End If
    and to call it in the main form, i just put use
    Code:
    workDiscount()
    . this works great if i only call it once! put i would need to use it a few times within the program!

    THanks for your help/

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I'm trying to reduce the amount of duplicate code in my program.
    Trying to refactor VB is like trying to fit a truck in a trash can, to use a rather American analogy. It just won't work, the language is too inflexible to allow itself to be refactored into a sensible shape.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Trying to refactor VB is like trying to fit a truck in a trash can,
    You mean pickup truck under a table?
    Sorry, couldn't resist. And, hey, it's a better visual.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Doesn't have quite the same ring to it Interesting that we both used truck analogies at more-or-less the same time though
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Oh, but you can visualize trying to place trucks under a table (complete with place settings and candles is most fun). The truck into a trash can just is a dead end thought
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

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