Data format from Text/settings file

ZeroEffect

Junior Contributor
Joined
Oct 24, 2004
Messages
204
Location
Detroit, MI
I am not sure where to start with this but here is my idea. I want to have a setting in my application that will be the format of a string I want to send out as an UDP packet. Now I know how to hard code the format and send the string out using UDP so that is not the issue. The issue is how do I make this format a user defined setting.

Example
Visual Basic:
'In the settings file

SendTextFormat = [124] [Artist] [126] [Title] [124]

'or

SendTextFormat = "This is " [Title] " By " [Artist]

'Then based on what is in the SendTextFormat the formatted data that would be sent would look like.

|The Last Goodnight~Pictures Of You|

'or

This is Pictures Of You By The Last Goodnight

This should be fairly easy but for some reason my brain is not processing what I want to do. The Artist and Title will all ready be in stringbuilders ready for use. But what is the best way to build the sting.

Thanks for any help you may have to offer.

ZeroEffect
 
I have made some progress but now have run into another problem with using "Select Case" For some reason it is skipping over/ignoring the values 26 through 100. The values 26 through 100 should be caught by the "case 0 to 255" but it is not. Anyone ever have this happen to them or know of what may be going on.

Here is my test code

Visual Basic:
'test input data
' [124] [13] [10] [34] [Artist] [34] [13] [10] [126] [Title] [124]

        Dim I As Integer = 0
        Dim strArtist As String = "The last Goodnight" 'For testing only
        Dim strTitle As String = "Pictures Of You" 'For testing only
        Dim strStringFmt() As String
        Dim strTranslatedFormat As String = ""
        TextBox2.Clear()

        strStringFmt = Split(TextBox1.Text, " ")

        For I = LBound(strStringFmt) To UBound(strStringFmt)

            'remove unwanted data from data selected data
            strStringFmt(I) = strStringFmt(I).Replace(Chr(34), "")
            'add data to textbox for tracking while testing
            TextBox2.AppendText(strStringFmt(I) & vbCrLf)

            strStringFmt(I) = strStringFmt(I).Replace("[", "")
            'add data to textbox for tracking while testing
            TextBox2.AppendText(strStringFmt(I) & vbCrLf)

            strStringFmt(I) = strStringFmt(I).Replace("]", "")
            'add data to textbox for tracking while testing
            TextBox2.AppendText(strStringFmt(I) & vbCrLf)


            Select Case UCase(strStringFmt(I))
                Case 0 To 255
'change number to ascii Character
                    strStringFmt(I) = Chr(strStringFmt(I))

'change other data as needed
                Case "TITLE"
                    strStringFmt(I) = strTitle

                Case "ARTIST"
                    strStringFmt(I) = strArtist

                Case "ALBUM"

                Case "LENGTH"

                Case "CUT"

                Case "GROUP"

            End Select

'build output string
            strTranslatedFormat = strTranslatedFormat & strStringFmt(I)

        Next
'display output string
        TextBox2.AppendText(vbCrLf & strTranslatedFormat)

Thanks for your help

ZeroEffect
 
I had to break up what I was searching through. When starting from zero if the ending value was greater than or equal to 100 case values 26 - 100 were ignored, how odd.

Visual Basic:
Case 0 To 99
     strStringFmt(I) = Chr(strStringFmt(I))

Case 100 To 255
     strStringFmt(I) = Chr(strStringFmt(I))
 
Back
Top