Move data to the top and leave empty if no data

70 views Asked by At

I have a flexgrid in VB6 that has data in Column 1 and Column 2 it is already populated based on my others code. How ever I have a code that insert a data in column 3 and this is my code.

Dim objDoc      As MSXML2.DOMDocument
    Dim objNodeList As IXMLDOMNodeList
    Dim objNode     As IXMLDOMNode
    Dim rowscount1  As Integer
    Dim rowcount    As Integer

    Set objDoc = New MSXML2.DOMDocument
    objDoc.async = False
    objDoc.Load App.Path & "\Extracted File\" & Text2.Text & "\content.xml"

    'Return all the segment elements
    Set objNodeList = objDoc.selectNodes("//draw:image")

    'loop through the segment elements and pull what you need

    flex.Cols = flex.Cols + 1

    For Each objNode In objNodeList
        Debug.Print objNode.Attributes.getNamedItem("xlink:href").Text

        With flex

             .Rows = .Rows + 1
              .TextMatrix(.Rows - 1, .ColIndex("3")) = Mid(objNode.Attributes.getNamedItem("xlink:href").Text, 10, Len(objNode.Attributes.getNamedItem("xlink:href").Text))

        End With

    Next objNode
rowscount1 = 0
    Set objNode = Nothing
    Set objNodeList = Nothing
    Set objDoc = Nothing

but the output is this.

Screenshot of the output

supposed to be all datas are together but what happens here is that the program created a row.

How can I fix this? Move data to the top and leave empty if no data.

0

There are 0 answers