Results 1 to 3 of 3

Thread: "Simplification" *[RESOLVED]*

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member RealNickyDude's Avatar
    Join Date
    Nov 2002
    Location
    Watching you through the hidden camera :o
    Posts
    435

    Thumbs up "Simplification" *[RESOLVED]*

    I have the following code (quite a lot of it actually):

    VB Code:
    1. Case "Misc Quick Tips"
    2.                 Dim docPath As String = IO.Path.Combine(Application.StartupPath, "code\tips\tips.rtf")
    3.                 rtbcodewindow.LoadFile(docPath, RichTextBoxStreamType.RichText)
    4.                 rtbcodewindow.Focus()
    5.                 StatusBar1.Text = "Code Section: Misc / Quick Tips"
    6.  
    7.                 'Internet
    8.             Case "Web graphic into picbox"
    9.                 Dim docPath As String = IO.Path.Combine(Application.StartupPath, "code\internet\urlpicbox.rtf")
    10.                 rtbcodewindow.LoadFile(docPath, RichTextBoxStreamType.RichText)
    11.                 rtbcodewindow.Focus()
    12.                 StatusBar1.Text = "Code Section: Internet / How to get a picture from a URL into a picturebox"
    13.  
    14.                 'Tutorials
    15.             Case "Menus"
    16.                 Dim docPath As String = IO.Path.Combine(Application.StartupPath, "code\tutorials\menus.rtf")
    17.                 rtbcodewindow.LoadFile(docPath, RichTextBoxStreamType.RichText)
    18.                 rtbcodewindow.Focus()
    19.                 StatusBar1.Text = "Code Section: Tutorials / Menus"
    and as you can see 90% of it is repeated in each Case statement. I wish to simplyfy this be calling a routine outside of the case statement by passing two arguments, something like this:

    LoadCode(<path to text to load>,<what to display in status bar>)

    I know you need a function and pass arguments, but how? Anybody help with this one?

    Thanks yall
    Last edited by RealNickyDude; Jan 15th, 2003 at 07:36 PM.
    [vbcode]
    On Error GoTo Hell
    [/vbcode]:¬) Nicky : Why not try VBCodebook.NET.

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