ZeroEffect Posted February 2, 2008 Posted February 2, 2008 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 '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 Quote If you can't find it, Build It. There is no place Like 127.0.0.1 also don't forget 1 + 1 = 10
ZeroEffect Posted February 3, 2008 Author Posted February 3, 2008 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 '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 Quote If you can't find it, Build It. There is no place Like 127.0.0.1 also don't forget 1 + 1 = 10
ZeroEffect Posted February 7, 2008 Author Posted February 7, 2008 anyone? Quote If you can't find it, Build It. There is no place Like 127.0.0.1 also don't forget 1 + 1 = 10
ZeroEffect Posted February 17, 2008 Author Posted February 17, 2008 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. Case 0 To 99 strStringFmt(I) = Chr(strStringFmt(I)) Case 100 To 255 strStringFmt(I) = Chr(strStringFmt(I)) Quote If you can't find it, Build It. There is no place Like 127.0.0.1 also don't forget 1 + 1 = 10
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.