move to last row at form_load |
Post Reply |
Author | |
winanjaya
Groupie Joined: 07 August 2005 Location: Indonesia Status: Offline Points: 19 |
Post Options
Thanks(0)
Posted: 14 September 2008 at 11:17am |
Dear All,
I am trying to move to last row at form load .. but it doesnot work.. what I missed? I need advise
Thanks & Regards
Winanjaya
Private Sub Form_Load()
CreateReportControl End Sub Private Sub CreateReportControl() 'Start adding columns Dim Column As ReportColumn Set Column = wndReportControl.Columns.Add(COLUMN_SENT1, "Sent Date", 50, True) Set Column = wndReportControl.Columns.Add(COLUMN_SENT2, "Sent Time", 50, True) Set Column = wndReportControl.Columns.Add(COLUMN_FROM, "From", 180, True) Set Column = wndReportControl.Columns.Add(COLUMN_TO, "To", 180, True) Set Column = wndReportControl.Columns.Add(COLUMN_MSG, "Msg", 180, False) wndReportControl.PaintManager.MaxPreviewLines = 1
PopulateSentItems wndReportControl.GroupsOrder.Add wndReportControl.Columns(0) wndReportControl.GroupsOrder(0).SortAscending = True wndReportControl.Columns(4).Visible = False Set fntStrike = wndReportControl.PaintManager.TextFont fntStrike.Strikethrough = True Set fntBold = wndReportControl.PaintManager.TextFont fntBold.Bold = True wndReportControl.Populate wndReportControl.SetCustomDraw xtpCustomBeforeDrawRow wndReportControl.Rows.Row(wndReportControl.Rows.Count - 1).Selected = True
End Sub
Private Sub PopulateSentItems()
Dim rsSentItems As New ADODB.Recordset Dim mSQL As String Dim mFrom As String, mTo As String, mUDate As String, mUTime As String, mMsg As String mSQL = "SELECT * FROM SMS WHERE STAT = '" & STAT & "' ORDER BY UDATE,UTIME" rsSentItems.Open mSQL, cnData, adOpenForwardOnly, adLockReadOnly If Not rsSentItems.EOF Then Do mFrom = rsSentItems!SENDER mTo = rsSentItems!dest mUDate = Format(rsSentItems!UDATE, "dd-mmm-yyyy") mUTime = Format(rsSentItems!UTIME, "hh:nn") mMsg = rsSentItems!MSG AddRecord mFrom, mTo, mUDate, mUTime, mMsg rsSentItems.MoveNext Loop Until rsSentItems.EOF End If errhand: rsSentItems.Close End Sub Public Sub AddRecord(ByVal pFrom As String, ByVal pTo As String, ByVal pUDate, ByVal pUTime As String, ByVal pPreview As String)
Dim Record As ReportRecord Set Record = wndReportControl.Records.Add() Dim Item As ReportRecordItem Set Item = Record.AddItem("") Record.AddItem pUDate Record.AddItem pUTime Record.AddItem pFrom Record.AddItem pTo Record.AddItem pPreview Record.PreviewText = pPreview End Sub Private Sub wndReportControl_SelectionChanged()
If Not wndReportControl.FocusedRow.GroupRow Then rtfText.Text = wndReportControl.FocusedRow.Record.PreviewText End If End Sub |
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi,
You can use:
But it seems that selecting the last row doesn't work as should. It selects the row but doesn't scroll to the last row. I have commandbars in form and when I float the CB the last row will be visible.
Try to set one of these methods at the end of form load and you will see that it works, also have the form maximized will work as should. I will add this "problem" to my major issue post and CJ will have a fix in next release.
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
Baldur
Senior Member Joined: 22 November 2006 Location: Germany Status: Offline Points: 244 |
Post Options
Thanks(0)
|
You can use:
Set MyReport.FocusedRow = MyReport.Rows(MyIndex)
This works as EnsureVisible in other controls.
Because you can have multiple selected rows, which should by focused ?
|
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi,
I found: when having a VB menu the RC selects last row but doesn't scroll to last row. I added DoEvents after populating RC and now the RC scrolls to last row as should.
wndReportControl.Populate
DoEvents
You can use one of the following lines:
No 2 is best way, this is by design
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |