none
Remove VbcrLf RRS feed

  • Question

  • Hi All,

    How to remove VbcrLf then put DataLines(I).Line in List of T (ResultFirstLine ).

    That List we want to use in form2. ResultFirstLine  contain data lines bellow;

    816,3839,0322,9767,7501,9824,8266,1477,3667,9471,8744,4642,9749,5976,9012,0209,1815,4031,3889,0712,0410,3754,7076
    5488,1815,1716,5955,2132,2632,9443,5020,5287,4649,6692,0844,3678,0203,0831,1030,4350,7168,5093,3965,5553,2886,3296
    5062,8098,2333,5265,3961,2893,6184,6366,9201,3477,5352,1134,4163,6517,7283,5603,0372,3537,1629,0073,9376,8399,1120
    1247,6402,0023,3017,7558,3594,7194,1421,4764,6392,7110,6789,5342,6273,4157,2928,3739,5850,5108,6145,6844,1187,6163
    7078,9988,4385,3413,6800,2096,1199,3937,9631,8458,1108,6062,6360,6319,3273,5020,4753,3796,3704,1391,4407,9585,7333
    0006,0196,7483,3352,6513,2950,9144,9764,6942,7070,4389,8424,0865,4656,4080,0817,7782,5023,4348,8142,5382,6643,2342
    6537,6102,9073,9870,2677,9297,6309,3874,9471,5152,5020,1033,5195,8242,3576,7847,6749,0674,1943,4734,7509,6653,1923
    1105,9743,4742,4052,7755,5671,6375,3373,1250,2851,3791,7679,8029,2593,6024,3074,2610,8729,1712,0340,6889,7087,6966

     Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
            TextBox2.Clear()
            For I As Integer = 0 To ListBox1.Items.Count - 1
                Dim FirstStr1 As String = CStr(ListBox1.Items(I))
                Dim FirstStr2 As String = CStr(ListBox2.Items(I))
                Dim FirstStr3 As String = CStr(ListBox3.Items(I))
    
                If FirstStr1 = ListBox1.SelectedItem.ToString AndAlso FirstStr2 = ListBox2.SelectedItem.ToString AndAlso FirstStr3 = ListBox3.SelectedItem.ToString Then
                    TextBox2.Text &= DataLines(I).Values_ToString & "   " & First(I) & "    " & Two(I) & "    " & vbCrLf & DataLines(I).Compare_ToString & "    " & DataLines(I).Digits_ToString & _
                                                                 "    " & vbCrLf & DataLines(I).Line & "    " & vbCrLf & DataLines(I).MaxList & "    " & vbCrLf & DataLines(I).MinList & "    " & vbCrLf & DataLines(I).MaxCount_ToString & "    " & vbCrLf & DataLines(I).MinCount_ToString & vbCrLf
    
                    'Dim s As String = TextBox2.Text
                    's = s.TrimEnd
    
                    ResultFirstLine.Add(DataLines(I).Line)
                End If
            Next

    Sunday, February 25, 2018 4:48 AM

Answers

  • 1.Yes, VbCrLf from TextBox2.Text.

    If you don't want the vbCrLf in textbox 2 then don't include it in the string that you are building when you populate the text box.

    TextBox2.Text &= DataLines(I).Values_ToString & "   " & First(I) & "    " & Two(I) & "    " & vbCrLf & DataLines(I).Compare_ToString & "    " & DataLines(I).Digits_ToString & _
       "    " & vbCrLf & DataLines(I).Line & "    " & vbCrLf & DataLines(I).MaxList & "    " & vbCrLf & DataLines(I).MinList & "    " & vbCrLf & DataLines(I).MaxCount_ToString & "    " & vbCrLf & DataLines(I).MinCount_ToString & vbCrLf
    

    What does this mean: "I need to clear vbCrLf because to use List ResultFirstLine   for counting digits."?

    If you want a particular item from that string, then use the value that you are using to create the string. What is ResultFirstLine? You need to show the data that you are using and the result you expect to get.

    • Marked as answer by mipakteh Tuesday, February 27, 2018 10:40 AM
    Sunday, February 25, 2018 7:38 AM
  • Hi mipakteh,

    I am not sure what you want to do, if you just remove VBcrLf from TextBox, you can use replcae to do this:

     TextBox1.Text = "123" & vbCrLf & "456" & vbCrLf & "789"
            TextBox1.Text = TextBox1.Text.Replace(vbCrLf, "")

    If not, please describe more detailed info about your issue here or provide more detailed code here.

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Cor Ligthert Monday, February 26, 2018 7:10 AM
    • Marked as answer by mipakteh Tuesday, February 27, 2018 10:40 AM
    Monday, February 26, 2018 6:04 AM
    Moderator

All replies

  • How to remove VbcrLf then put DataLines(I).Line in List of T (ResultFirstLine ).

    Remove vbCrLf from what?  The only thing that seems to have a vbCrLf is Textbox2.Text, and they are only there because you have included them in the code that creates that text.  If you don't include them, there is no need to remove them. What is DataLines?

    Sunday, February 25, 2018 6:40 AM
  • Hi Acamar,

    1.Yes, VbCrLf from TextBox2.Text.

    2.DataLines come from selected Item Listbox.

    6816,3839,0322,9767,7501,9824,8266,1477,3667,9471,8744,4642,9749,5976,9012,0209,1815,4031,3889,0712,0410,3754,7076
    5488,1815,1716,5955,2132,2632,9443,5020,5287,4649,6692,0844,3678,0203,0831,1030,4350,7168,5093,3965,5553,2886,3296
    5062,8098,2333,5265,3961,2893,6184,6366,9201,3477,5352,1134,4163,6517,7283,5603,0372,3537,1629,0073,9376,8399,1120
    1247,6402,0023,3017,7558,3594,7194,1421,4764,6392,7110,6789,5342,6273,4157,2928,3739,5850,5108,6145,6844,1187,6163
    7078,9988,4385,3413,6800,2096,1199,3937,9631,8458,1108,6062,6360,6319,3273,5020,4753,3796,3704,1391,4407,9585,7333
    0006,0196,7483,3352,6513,2950,9144,9764,6942,7070,4389,8424,0865,4656,4080,0817,7782,5023,4348,8142,5382,6643,2342
    6537,6102,9073,9870,2677,9297,6309,3874,9471,5152,5020,1033,5195,8242,3576,7847,6749,0674,1943,4734,7509,6653,1923
    1105,9743,4742,4052,7755,5671,6375,3373,1250,2851,3791,7679,8029,2593,6024,3074,2610,8729,1712,0340,6889,7087,6966

    3.Textbox2.text contains;

                                    

    1 ,1 ,1 ,1 ,2 ,4 ,   1    1    
    10 => 4 ,8 => 2 ,7 => 1 ,11 => 1 ,4 => 1 ,14 => 1 ,    0 => 10 ,
    1 => 10 ,
    2 => 8 ,
    3 => 7 ,
    4 => 11 ,
    5 => 4 ,
    6 => 10 ,
    7 => 14 ,
    8 => 8 ,
    9 => 10 ,

    6816,3839,0322,9767,7501,9824,8266,1477,3667,9471,8744,4642,9749,5976,9012,0209,1815,4031,3889,0712,0410,3754,7076    
    Max of Digits 7 : 14     
    Min of Digits 5 : 4     
    Max Count 1    
    Min Count 1
    1 ,1 ,1 ,1 ,2 ,4 ,   1    1    
    10 => 4 ,8 => 2 ,12 => 1 ,13 => 1 ,4 => 1 ,7 => 1 ,    0 => 10 ,
    1 => 8 ,
    2 => 10 ,
    3 => 12 ,
    4 => 8 ,
    5 => 13 ,
    6 => 10 ,
    7 => 4 ,
    8 => 10 ,
    9 => 7 ,

    5488,1815,1716,5955,2132,2632,9443,5020,5287,4649,6692,0844,3678,0203,0831,1030,4350,7168,5093,3965,5553,2886,3296    
    Max of Digits 5 : 13     
    Min of Digits 7 : 4     
    Max Count 1    
    Min Count 1
    1 ,1 ,1 ,1 ,2 ,4 ,   1    1    
    8 => 4 ,10 => 2 ,18 => 1 ,4 => 1 ,12 => 1 ,6 => 1 ,    0 => 8 ,
    1 => 10 ,
    2 => 10 ,
    3 => 18 ,
    4 => 4 ,
    5 => 8 ,
    6 => 12 ,
    7 => 8 ,
    8 => 6 ,
    9 => 8 ,

    5062,8098,2333,5265,3961,2893,6184,6366,9201,3477,5352,1134,4163,6517,7283,5603,0372,3537,1629,0073,9376,8399,1120    
    Max of Digits 3 : 18     
    Min of Digits 4 : 4     
    Max Count 1    
    Min Count 1
    1 ,1 ,1 ,1 ,2 ,4 ,   1    1    
    7 => 2 ,13 => 1 ,9 => 4 ,12 => 1 ,11 => 1 ,6 => 1 ,    0 => 7 ,
    1 => 13 ,
    2 => 9 ,
    3 => 9 ,
    4 => 12 ,
    5 => 9 ,
    6 => 9 ,
    7 => 11 ,
    8 => 7 ,
    9 => 6 ,

    1247,6402,0023,3017,7558,3594,7194,1421,4764,6392,7110,6789,5342,6273,4157,2928,3739,5850,5108,6145,6844,1187,6163    
    Max of Digits 1 : 13     
    Min of Digits 9 : 6     
    Max Count 1    
    Min Count 1
    1 ,1 ,1 ,1 ,2 ,4 ,   1    1    
    11 => 2 ,9 => 4 ,4 => 1 ,17 => 1 ,7 => 1 ,6 => 1 ,    0 => 11 ,
    1 => 9 ,
    2 => 4 ,
    3 => 17 ,
    4 => 7 ,
    5 => 6 ,
    6 => 9 ,
    7 => 9 ,
    8 => 9 ,
    9 => 11 ,

    7078,9988,4385,3413,6800,2096,1199,3937,9631,8458,1108,6062,6360,6319,3273,5020,4753,3796,3704,1391,4407,9585,7333    
    Max of Digits 3 : 17     
    Min of Digits 2 : 4     
    Max Count 1    
    Min Count 1
    1 ,1 ,1 ,1 ,2 ,4 ,   1    1    
    12 => 1 ,5 => 1 ,10 => 4 ,15 => 1 ,7 => 2 ,6 => 1 ,    0 => 12 ,
    1 => 5 ,
    2 => 10 ,
    3 => 10 ,
    4 => 15 ,
    5 => 7 ,
    6 => 10 ,
    7 => 7 ,
    8 => 10 ,
    9 => 6 ,

    0006,0196,7483,3352,6513,2950,9144,9764,6942,7070,4389,8424,0865,4656,4080,0817,7782,5023,4348,8142,5382,6643,2342    
    Max of Digits 4 : 15     
    Min of Digits 1 : 5     
    Max Count 1    
    Min Count 1
    1 ,1 ,1 ,1 ,2 ,4 ,   1    1    
    9 => 4 ,7 => 1 ,8 => 1 ,11 => 2 ,15 => 1 ,4 => 1 ,    0 => 9 ,
    1 => 7 ,
    2 => 8 ,
    3 => 11 ,
    4 => 9 ,
    5 => 9 ,
    6 => 9 ,
    7 => 15 ,
    8 => 4 ,
    9 => 11 ,

    6537,6102,9073,9870,2677,9297,6309,3874,9471,5152,5020,1033,5195,8242,3576,7847,6749,0674,1943,4734,7509,6653,1923    
    Max of Digits 7 : 15     
    Min of Digits 8 : 4     
    Max Count 1    
    Min Count 1
    1 ,1 ,1 ,1 ,2 ,4 ,   1    1    
    10 => 2 ,9 => 4 ,7 => 1 ,15 => 1 ,6 => 1 ,8 => 1 ,    0 => 10 ,
    1 => 9 ,
    2 => 10 ,
    3 => 9 ,
    4 => 7 ,
    5 => 9 ,
    6 => 9 ,
    7 => 15 ,
    8 => 6 ,
    9 => 8 ,

    1105,9743,4742,4052,7755,5671,6375,3373,1250,2851,3791,7679,8029,2593,6024,3074,2610,8729,1712,0340,6889,7087,6966    
    Max of Digits 7 : 15     
    Min of Digits 8 : 6     
    Max Count 1    
    Min Count 1

    I need to clear vbCrLf because to use List ResultFirstLine   for counting digits.

    on form2.If not counting only do for 2 line only.

    Sunday, February 25, 2018 7:09 AM
  • 1.Yes, VbCrLf from TextBox2.Text.

    If you don't want the vbCrLf in textbox 2 then don't include it in the string that you are building when you populate the text box.

    TextBox2.Text &= DataLines(I).Values_ToString & "   " & First(I) & "    " & Two(I) & "    " & vbCrLf & DataLines(I).Compare_ToString & "    " & DataLines(I).Digits_ToString & _
       "    " & vbCrLf & DataLines(I).Line & "    " & vbCrLf & DataLines(I).MaxList & "    " & vbCrLf & DataLines(I).MinList & "    " & vbCrLf & DataLines(I).MaxCount_ToString & "    " & vbCrLf & DataLines(I).MinCount_ToString & vbCrLf
    

    What does this mean: "I need to clear vbCrLf because to use List ResultFirstLine   for counting digits."?

    If you want a particular item from that string, then use the value that you are using to create the string. What is ResultFirstLine? You need to show the data that you are using and the result you expect to get.

    • Marked as answer by mipakteh Tuesday, February 27, 2018 10:40 AM
    Sunday, February 25, 2018 7:38 AM
  • Hi mipakteh,

    I am not sure what you want to do, if you just remove VBcrLf from TextBox, you can use replcae to do this:

     TextBox1.Text = "123" & vbCrLf & "456" & vbCrLf & "789"
            TextBox1.Text = TextBox1.Text.Replace(vbCrLf, "")

    If not, please describe more detailed info about your issue here or provide more detailed code here.

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Cor Ligthert Monday, February 26, 2018 7:10 AM
    • Marked as answer by mipakteh Tuesday, February 27, 2018 10:40 AM
    Monday, February 26, 2018 6:04 AM
    Moderator
  • Hi Kunmo bu,

    I think Acamar suggestion is good {If you don't want the vbCrLf in textbox 2 then don't include it}. But if I remove

    it was mess in Textbox2 .same with your code.

    1 ,1 ,1 ,1 ,2 ,4 ,   1    1    10 => 4 ,8 => 2 ,7 => 1 ,11 => 1 ,4 => 1 ,14 => 1 ,    0 => 10 ,1 => 10 ,2 => 8 ,3 => 7 ,4 => 11 ,5 => 4 ,6 => 10 ,7 => 14 ,8 => 8 ,9 => 10 ,    6816,3839,0322,9767,7501,9824,8266,1477,3667,9471,8744,4642,9749,5976,9012,0209,1815,4031,3889,0712,0410,3754,7076    Max of Digits 7 : 14     Min of Digits 5 : 4     Max Count 1    Min Count 11 ,1 ,1 ,1 ,2 ,4 ,   1    1    10 => 4 ,8 => 2 ,12 => 1 ,13 => 1 ,4 => 1 ,7 => 1 ,    0 => 10 ,1 => 8 ,2 => 10 ,3 => 12 ,4 => 8 ,5 => 13 ,6 => 10 ,7 => 4 ,8 => 10 ,9 => 7 ,    5488,1815,1716,5955,2132,2632,9443,5020,5287,4649,6692,0844,3678,0203,0831,1030,4350,7168,5093,3965,5553,2886,3296    Max of Digits 5 : 13     Min of Digits 7 : 4     Max Count 1    Min Count 11 ,1 ,1 ,1 ,2 ,4 ,   1    1    8 => 4 ,10 => 2 ,18 => 1 ,4 => 1 ,12 => 1 ,6 => 1 ,    0 => 8 ,1 => 10 ,2 => 10 ,3 => 18 ,4 => 4 ,5 => 8 ,6 => 12 ,7 => 8 ,8 => 6 ,9 => 8 ,    5062,8098,2333,5265,3961,2893,6184,6366,9201,3477,5352,1134,4163,6517,7283,5603,0372,3537,1629,0073,9376,8399,1120    Max of Digits 3 : 18     Min of Digits 4 : 4     Max Count 1    Min Count 11 ,1 ,1 ,1 ,2 ,4 ,   1    1    7 => 2 ,13 => 1 ,9 => 4 ,12 => 1 ,11 => 1 ,6 => 1 ,    0 => 7 ,1 => 13 ,2 => 9 ,3 => 9 ,4 => 12 ,5 => 9 ,6 => 9 ,7 => 11 ,8 => 7 ,9 => 6 ,    1247,6402,0023,3017,7558,3594,7194,1421,4764,6392,7110,6789,5342,6273,4157,2928,3739,5850,5108,6145,6844,1187,6163    Max of Digits 1 : 13     Min of Digits 9 : 6     Max Count 1    Min Count 11 ,1 ,1 ,1 ,2 ,4 ,   1    1    11 => 2 ,9 => 4 ,4 => 1 ,17 => 1 ,7 => 1 ,6 => 1 ,    0 => 11 ,1 => 9 ,2 => 4 ,3 => 17 ,4 => 7 ,5 => 6 ,6 => 9 ,7 => 9 ,8 => 9 ,9 => 11 ,    7078,9988,4385,3413,6800,2096,1199,3937,9631,8458,1108,6062,6360,6319,3273,5020,4753,3796,3704,1391,4407,9585,7333    Max of Digits 3 : 17     Min of Digits 2 : 4     Max Count 1    Min Count 11 ,1 ,1 ,1 ,2 ,4 ,   1    1    12 => 1 ,5 => 1 ,10 => 4 ,15 => 1 ,7 => 2 ,6 => 1 ,    0 => 12 ,1 => 5 ,2 => 10 ,3 => 10 ,4 => 15 ,5 => 7 ,6 => 10 ,7 => 7 ,8 => 10 ,9 => 6 ,    0006,0196,7483,3352,6513,2950,9144,9764,6942,7070,4389,8424,0865,4656,4080,0817,7782,5023,4348,8142,5382,6643,2342    Max of Digits 4 : 15     Min of Digits 1 : 5     Max Count 1    Min Count 11 ,1 ,1 ,1 ,2 ,4 ,   1    1    9 => 4 ,7 => 1 ,8 => 1 ,11 => 2 ,15 => 1 ,4 => 1 ,    0 => 9 ,1 => 7 ,2 => 8 ,3 => 11 ,4 => 9 ,5 => 9 ,6 => 9 ,7 => 15 ,8 => 4 ,9 => 11 ,    6537,6102,9073,9870,2677,9297,6309,3874,9471,5152,5020,1033,5195,8242,3576,7847,6749,0674,1943,4734,7509,6653,1923    Max of Digits 7 : 15     Min of Digits 8 : 4     Max Count 1    Min Count 11 ,1 ,1 ,1 ,2 ,4 ,   1    1    10 => 2 ,9 => 4 ,7 => 1 ,15 => 1 ,6 => 1 ,8 => 1 ,    0 => 10 ,1 => 9 ,2 => 10 ,3 => 9 ,4 => 7 ,5 => 9 ,6 => 9 ,7 => 15 ,8 => 6 ,9 => 8 ,    1105,9743,4742,4052,7755,5671,6375,3373,1250,2851,3791,7679,8029,2593,6024,3074,2610,8729,1712,0340,6889,7087,6966    Max of Digits 7 : 15     Min of Digits 8 : 6     Max Count 1    Min Count 1

    Monday, February 26, 2018 1:23 PM
  • Hi Kunmo bu,

    I think Acamar suggestion is good {If you don't want the vbCrLf in textbox 2 then don't include it}. But if I remove

    it was mess in Textbox2 .same with your code.

    4,3074,2610,8729,1712,0340,6889,7087,6966    Max of Digits 7 : 15     Min of Digits 8 : 6     Max Count 1    Min Count 1

    Yea, Garbage in, Garbage out. 

    But the solution to remove a vbcrlf as she gave was correct. 


    Success
    Cor


    Monday, February 26, 2018 1:32 PM
  • it was mess in Textbox2 .same with your code.

    Then why are you asking how to remove it?  If you are trying to format the text box differently then show what you are trying to achieve.  If you want to remove it for some other reason then you need to explain the problem in more detail.

    Monday, February 26, 2018 8:41 PM
  • textbox as a place to show a nice result, Acamar.That reason only.

    It come problem when I want to use again at form2.

    Tuesday, February 27, 2018 10:40 AM
  • It come problem when I want to use again at form2.

    The text box is for display.  If you want to use that data in Form 2 then use the same source of data that you use to create the text box text.
    Tuesday, February 27, 2018 11:32 AM
  • Ok,Thank
    Tuesday, February 27, 2018 12:49 PM