|
-
March 22nd, 2012, 06:35 AM
#1
mshflexgrid doubt
I am facing a strange issue regarding mshflexgrid. mshflexgrid1.rows is returning 5 while on the grid i can see only 1 row. please help me asap.
For I = 1 To rs.recordcount
frmresolveBase2File.MSHFlexGrid1.Row = l
tranDatetime = Format(rs!tran_datetime, "yyyy-mm-dd")
If tranDatetime >= startDate Then
l = l + 1
Else
If frmresolveBase2File.MSHFlexGrid1.Rows > 2 Then
frmresolveBase2File.MSHFlexGrid1.RemoveItem (l)
Else
frmresolveBase2File.MSHFlexGrid1.Clear
End If
End If
rs.MoveNext
Next
rows = MSHFlexGrid1.Rows
i am trying to filter the grid by date. here rows = 5 while on the display i can see only 1 row.
-
March 22nd, 2012, 08:23 AM
#2
Re: mshflexgrid doubt
Nowhere in your code do you show how you actually put some data into the grid
This statement changes the row number - thats all - no data is changed - displayed, removed or otherwise - You are just adding 1 to the row number and if you had 100 rows which didn't fit your date range you might be sitting on row 100
Code:
If tranDatetime >= startDate Then
l = l + 1
You clear the grid - you remove a line from the grid but nowhere do you put anything into the grid
You can see one line - I see none
-
March 22nd, 2012, 08:39 AM
#3
Re: mshflexgrid doubt
thanks..
I am clearing it only only if number of rows is 1 + 1 header row. That is because i am unable to delete the last fixed row.
i am inserting the data in the grid before the last added code as:
Set MSHFlexGrid1.DataSource = rs
if i check the MSHFlexGrid1.rows property then it returns 10 but i am just able to see 1 row on the display..
-
March 22nd, 2012, 08:40 AM
#4
Re: mshflexgrid doubt
If the date is greater then the start date then it shouldnot remove the row..
-
March 22nd, 2012, 08:56 AM
#5
Re: mshflexgrid doubt
Always a good idea to clear your grid before
Code:
Set MSHFlexGrid1.DataSource = rs
ie, MSHFlexGrid1.Clear
Also, after populating with the rs, you may need to remove row 1 which often is left blank
Check rs.recordcount to see how many records are in the recordset before populating
Code:
Msgbox rs.recordcount
-
March 23rd, 2012, 05:29 PM
#6
Re: mshflexgrid doubt
The problem could be the databinding.
If your flexgrid has rs (a recordset) as DataSource, then .RemoveItem wouldn't work.
You'd have to remove the record from the recordset to make it actually disappear from the grid.
It all depends how you entered the data to the grid...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|