none
Looping a fields RRS feed

  • Question

  • In VS2010 I am creating a report. The results of one field reports it like  "61HP KUBOTA | 12,100LBS OPERATING WEIGHT | 1.10CUYD CLASS | HYDRAULIC SSL QUICK COUPLER " and I would like to to show like 

    61HP KUBOTA

    12,100LBS OPERATING WEIGHT

    1.10CUYD CLASS

    HYDRAULIC SSL QUICK COUPLER

    I found this bit of code but I have no idea where in the field proprties would I put it once i adapted it fit my situation

    Private Sub Command1_Click()
    Dim strTest As String
    Dim strArray() As String
    Dim intCount As Integer

    strTest = "Fred & Wilma & Barney & Betty"
    strArray = Split(strTest, "&")

    For intCount = LBound(strArray) To UBound(strArray)
    Debug.Print Trim(strArray(intCount))
    Next
    End Sub

    • Moved by 宝宝徐 Monday, July 24, 2017 5:26 AM
    Friday, July 21, 2017 6:19 PM

All replies

  • Hi,

    Welcome to MSDN forum.

    This forum is discussing Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor. I will move your thread to VB forum.

    Best regards,

    Joyce


    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.

    Monday, July 24, 2017 5:24 AM
  • Hi GoodBoyFrankie,

    According to your description and your code, you want to traverse the array. Now you find one sample that can do this, but you want to know how to fit your situation, you can refer to the code below.

    Dim strTest As String
            Dim strArray() As String
            Dim intCount As Integer
    
            strTest = "61HP KUBOTA | 12,100LBS OPERATING WEIGHT | 1.10CUYD CLASS | HYDRAULIC SSL QUICK COUPLER "
            strArray = Split(strTest, " |")
    
            For intCount = LBound(strArray) To UBound(strArray)
                'Console.WriteLine(strArray(intCount).Trim())
                Debug.Print Trim(strArray(intCount).Trim())
            Next
    

    It just split the string first, and then traverse the string.

    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.

    Monday, July 24, 2017 5:32 AM
    Moderator
  • In VS2010 I am creating a report. The results of one field reports it like  "61HP KUBOTA | 12,100LBS OPERATING WEIGHT | 1.10CUYD CLASS | HYDRAULIC SSL QUICK COUPLER " and I would like to to show like

    Debug.Print("61HP KUBOTA | 12,100LBS OPERATING WEIGHT | 1.10CUYD CLASS | HYDRAULIC SSL QUICK COUPLER ".Replace(" | ", vbCrLf))
    
    It's not a part of the field properties - it is a piece of code that you insert at that point in the application where the information is available and needs to be displayed. You have not provided enough detail about your application to know what that might be.

    Monday, July 24, 2017 5:54 AM
  • Hi GoodBoyFrankie,

    Have you solved your issue now? If yes, please update here.

     If no, what is your report?

    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.

    Wednesday, July 26, 2017 8:15 AM
    Moderator