"Simplification" *[RESOLVED]*
I have the following code (quite a lot of it actually):
VB Code:
Case "Misc Quick Tips"
Dim docPath As String = IO.Path.Combine(Application.StartupPath, "code\tips\tips.rtf")
rtbcodewindow.LoadFile(docPath, RichTextBoxStreamType.RichText)
rtbcodewindow.Focus()
StatusBar1.Text = "Code Section: Misc / Quick Tips"
'Internet
Case "Web graphic into picbox"
Dim docPath As String = IO.Path.Combine(Application.StartupPath, "code\internet\urlpicbox.rtf")
rtbcodewindow.LoadFile(docPath, RichTextBoxStreamType.RichText)
rtbcodewindow.Focus()
StatusBar1.Text = "Code Section: Internet / How to get a picture from a URL into a picturebox"
'Tutorials
Case "Menus"
Dim docPath As String = IO.Path.Combine(Application.StartupPath, "code\tutorials\menus.rtf")
rtbcodewindow.LoadFile(docPath, RichTextBoxStreamType.RichText)
rtbcodewindow.Focus()
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 :D