I posted this to the forum for someone asking questions who was acting very arrogant, so I decided to delete my posts from that thread’ I felt like this code still offers someone else the opportunity to learn, so I moved to this blog.

Here is an example of making a custom program skinnable, but be informed that every little detail needs to be addressed. If you need to make for the skin writer(end user) to be able to specify drag areas of the form, then you need to create that logic. Every single little detail that you wish to be customized, needs to be added to the library, and also the logic to: Serialize, deserialize, validate, and apply it.

This is an extreme amount of work to allow for skinnable applications, so I hope your application is worth skinning.

Example Configuration File(Created with the SimpleSkin.ToXMLFile method)
*Note if you would like to add more fields, you need to modify the library(listed further down)

Hello the site that this was hosted on went down, so I figured now was a good time to bring it over to my blog. Later I will fix any “option strict off” errors, and review it against my current understanding of things.

A user of the MSDN forums asked the following question:(in this thread)

Hi, I want to thank everyone in advance for any help you can offer. I am an amateur programmer and I have been able to turn to this forum repeatedly for help with my problems — and this is deeply appreciated by me! Thank you!

I want to load a .csv file into a datagridview. The .csv file has 10 columns and at least 70,000 to 100,000 rows. When the program loads the file, the whole program freezes for several minutes. I eventually figured out that I could use a background worker to do things. However, when I tried to have the background worker add rows to the datagridview, I got an error message saying that it couldn’t because the datagridview was created on another thread than its own. …. I am wondering how I can solve this issue? Here is the program:

Basically, what is happening is that when you access an object on one thread from another thread, this creates an unstable system environment. The way for getting around this is to check and see if an invoke is required for that object, and basically, if it is, you invoke a new delegate sub on the same thread of the datagridview, hence avoiding access across threads, because the delegate sub exists on the same thread as the datagridview. See example

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If DateTime.Now.Hour >= 6 And DateTime.Now.Hour < 12 Then
Message.Text = "Good Morning"
End If
If DateTime.Now.Hour >= 12 And DateTime.Now.Hour <= 17 Then
Message.Text = "Good Afternoon"
End If
If DateTime.Now.Hour > 17 Or DateTime.Now.Hour < 6 Then
Message.Text = "Good Evening"
End If
End Sub

and change it into a function. the original code basically displays one of the messages on a webpage when opened depending what time of day it is. I was looking for some help on how or what i need to change to turn it into a function.

The code below i have edit but only slightly so anything that looks completely wrong will be because i have only edited a small part of it so the ByVal in the function i have to not tried to implement into the function as i am a bit stuck.

When you write a Method, you need to take the following into consideration:

1.) Access Level
2.) Method Type(Function? or Sub?)
*A function will return a value, a sub will perform an operation without returning a value.

3.) Method Naming. Example, a function that returns someones age could be named “GetAge”
4.) Any parameters you may wish to pass.
5.) If you create a function, you need to declare the function “As” it’s expected return type
example:

A function that will return a string may be created like this:

Public Function GetString(param As String) As String
Return "Hello" & param
End Function

The usage of that function may look like this:

Me.Text = GetString(" World!")

So inside your function that you are expected to create, instead of directly modifying an object’s text property, you will return the message using the “Return” keyword. When that function is used later, you will set the object’s text property with the direct output of your function.

A user in the MSDN forums asked the following question in the following thread:

Hello, I am very new to programming and would like some help. I need a program that will search in a supplied folder and list all PDF type of file in a text box, and then have the operator select the file to open.

Can someone show me the code to do this?

Here is how I would.

''' <summary>
''' Returns the path to a pdf file that the user selected. Returns a blank if the user cancelled.
''' </summary>
''' <returns></returns>
''' <remarks></remarks>
Function OpenPDF() As String
Dim OFD As New OpenFileDialog
OFD.Filter = "Pdf Files|*.pdf"
If OFD.ShowDialog = DialogResult.OK Then
Return OFD.FileName
End If
Return ""
End Function