are you talking about the code needed to make a text box/area where your able to produce spun content ?
You'd do it pretty much the way you'd do it in any similar language.
Open your spun file. Create an output file. Start reading the input file until you come to an opening "{" bracket. Send all the characters up to but not including the bracket to the output file.
Then, begin counting the "|" characters until you come to the end "}" bracket. Add one to the count. Generate a random integer between 1 and the count. Go back to the opening bracket, starting to form a string until you get to the "|" character again. Pick the string the corresponds to the random number selected earlier.
Send that string to your output file.
Proceed as before, going through and looking for the next opening bracket, writing all the character up to the bracket to the output file. etc. etc.
Save the output file.
Public Function Spin(ByVal SourceString As String) As String
'
' Create a temp return info
'
Dim ReturnString As New System.Text.StringBuilder
'
' The loop position in the source string
'
Dim I As Integer = 0
'
' Sart a new random sequence
'
Randomize()
'
' While there is something in the source
'
Do While I < SourceString.Length
'
' Get the char to process
'
Dim c As Char = SourceString.Chars(I)
'
' Depending on the char
'
Select Case c
Case "{"c
'
' This is an opening so must start a deeper level
'
ReturnString.Append(Spin(SourceString.Substring(I + 1)))
Exit Do
Case "}"c
'
' This is a closing one.
'--------------------------------------------------------
'
' calculate the options using the | separator
'
Dim Options As String() = ReturnString.ToString.Split("|"c)
'
' Clear the return string to get an option.
'
ReturnString = New System.Text.StringBuilder
'
' Get the option
'
ReturnString.Append(Options(CType(Math.Floor(Rnd() * CType(Options.Length, Single)), Integer)))
'
' Get hte rest of the string past the closing bracket
'
If I < SourceString.Length - 1 Then
'
' Disregard all the source before the ending bracket and reset the pointer
'
SourceString = SourceString.Substring(I + 1)
I = -1
Else
'
' If this is the last char, then nothing more to analyze
'
SourceString = ""
End If
Case Else
'
' this is a normal char
'
ReturnString.Append(c)
End Select
'
' Go for the next char
'
I += 1
Loop
'
' Return the valid string
'
Return ReturnString.ToString
End Function
TextBox2.Text = Spin(TextBox1.Text)