Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21266

How to add multiple rows in multiple locations in MSFLEXGRID

$
0
0
I want to run a program where the rows will be added based on the no of records returned from DB .
My header is already built with 12 rows and no of required columns.
Like if 4 records are present in jan then after JAN row then 4 rows need to be inserted.

The problem is whatever the date all rows are getting added after january row. I am sharing my code . Please give the suggestion .

While rs.EOF <> True


dom = Format(rs.Fields(2), "mm/dd/yy")
sel_y = Right$(cmbYear.Text, 2)

dom_y = Right$(dom, 2)

If sel_y = dom_y Then

dom_m = Month(dom)

dom_d = Day(dom)

For m_no = 1 To 12
If dom_m = m_no Then
yearDisplay.AddItem " ", (dom_m + 1) ' This line adds row after the jan row
yearDisplay.TextMatrix(m_no + 1, dom_d * 2) = rs.Fields(0).value
yearDisplay.Row = m_no + 1
yearDisplay.col = dom_d * 2
yearDisplay.CellBackColor = vbGreen


yearDisplay.TextMatrix(m_no + 1, dom_d * 2 + 1) = rs.Fields(1).value
yearDisplay.Row = m_no + 1
yearDisplay.col = (dom_d * 2 + 1)
yearDisplay.CellBackColor = vbYellow

End If
Next



End If

rs.MoveNext
Wend

Viewing all articles
Browse latest Browse all 21266

Trending Articles