MS FlexGrid

I have designed a page which can be used to input employee details. I added a MSFlexGrid to that page,in which i wanted to add the records.

My problem is, after entering the record I will save that record. So, once it is saved it should display in that MSflexGrid. How  to do this????

I tried it is getting saved, but at the same time it is not appearing in MSFlexGrid. Once u close the program and then open the same u can find the saved record displayed in MSFlex.

So, what should I do, if I want to see my records in MSFlexGrid immediately when i saved a record.

....Ravi.
kudamalaAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
TimCotteeConnect With a Mentor Commented:
There are a number of ways to do this. If you have a recordset bound to the flexgrid then after the new record has been added you will need to refresh the recordset and then reassign it to the flexgrid:

ADODC1.Refresh ' If using ADO Datacontrol
Data1.Refresh ' If using Intrinsic data control
Set MSFlexgrid1.DataSource = ADODC1 ' Or Data1 depending on data control in use.

This should redisplay the grid with the newly added record showing.
0
 
puranik_pCommented:
Hoe about using a datagrid instead of MSFlexgrid?
keep it updatable and you don't have to write code for refreshing ADODC or the grid.
0
 
Valliappan ANSenior Tech ConsultantCommented:
If you are using, recordset, try:

rs.requery
(or)
re-open the recordset again.
and bind it to the MSHFlexGrid again.

You can also try like this for ADO Data Control:
ADODC1.Recordset.Requery

Cheers.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Valliappan ANSenior Tech ConsultantCommented:
sorry, not MSHFlexGrid, its MSFlexGrid, right?
0
 
Ryan ChongCommented:
hi kudamala, MSFlexGrid control only compatible with intrinsic data control and remote data control such as Data Control and Remote Data Control (RDO), but not with ADODC.

You can pair MSFlexGrid with either Data Control or RDO by set its DataSource property.
0
 
sureshpodarallaCommented:
Public Sub FlexiGridDisplay()

    ' Make room for column widths.
    num_cols = rst.Fields.Count
    ReDim col_wid(0 To num_cols - 1)

    ' Set column headerst.
    frmScan.flxResults.Rows = 2
    frmScan.flxResults.Cols = num_cols
    frmScan.flxResults.FixedCols = 0
    frmScan.flxResults.FixedRows = 1
    For c = 0 To num_cols - 1
       ' frmScan.flxResults.TextMatrix(0, c) = rst.Fields(c).Name
        frmScan.flxResults.TextMatrix(0, 0) = "Col1"
        frmScan.flxResults.TextMatrix(0, 1) = "col2"
        frmScan.flxResults.TextMatrix(0, 2) = "col3"
        frmScan.flxResults.TextMatrix(0, 3) = "col4"
        frmScan.flxResults.TextMatrix(0, 4) = "col5"
        frmScan.flxResults.TextMatrix(0, 5) = "col6"
        ' See if we need to enlarge the column.
        new_wid = frmScan.TextWidth(rst.Fields(c).Name)
        If col_wid(c) < new_wid Then col_wid(c) = new_wid
    Next c
    r = 0
    Do Until rst.EOF
        r = r + 1
        frmScan.flxResults.Rows = r + 1
        For c = 0 To rst.Fields.Count - 1
            ' if there is something in column
            If (Len(rst.Fields(c).Value)) Then
                frmScan.flxResults.TextMatrix(r, c) = rst.Fields(c).Value
                ' See if we need to enlarge the column.
                ' new_wid = Len(rst.Fields(c).Value)
                new_wid = frmScan.TextWidth(rst.Fields(c).Value)
            Else
                ' otherwise, use blank. if we don't do this
                ' it will die because of the invalid use of Null
                frmScan.flxResults.TextMatrix(r, c) = " "
                new_wid = 0
            End If
           
            ' Which ever is bigger that is going to be the new
            ' current col_wid(c)
           
            If col_wid(c) < new_wid Then col_wid(c) = new_wid
        Next c
        rst.MoveNext
    Loop
End If

    ' Set the grid's column widths.
    For c = 0 To num_cols - 1
        frmScan.flxResults.ColWidth(c) = col_wid(c) + 120
    Next

    ' Display the grid.
    frmScan.flxResults.Visible = True
   
    rst.Close
End Sub


I hope this will help you

Thanks,
suresh podaralla
0
 
DanRollinsCommented:
Hi kudamala@devx,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:

    Accept TimCottee's comment(s) as an answer.

kudamala@devx, if you think your question was not answered at all or if you need help, you can simply post a new comment here.  Community Support moderators will follow up.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
Computer101Commented:
Comment from expert accepted as answer

Computer101
E-E Moderator
0
All Courses

From novice to tech pro — start learning today.