Skip to main content

Posts

Showing posts from October, 2007

Search on key up

public void SearchOnKeyUp(string strTableName , string strIDColumnName , string strCodeColumnName , string strNameColumnName , TextBox txtCode , TextBox txtName , KeyEventArgs e) { string sTypedText = ""; string sFoundText = ""; string sAppendText = ""; string strSQL = ""; DBUtilities db = new DBUtilities(); DataSet ds = null; switch (e.KeyCode) { case Keys.Back: break; case Keys.Left: break; case Keys.Right: break; case Keys.Tab: break; case Ke...

Zoom a picture

'picImg: original picture 'img: picture after zoomed 'm_nWidth, m_nHeight: picture size to be zoomed nTileX = picImg.Width / m_nWidth nTileY = picImg.Height / m_nHeight If nTileX img.Width = img.Width * nTileX / nTileY Else img.Height = img.Height * nTileY / nTileX End If img.Picture = picImg.Picture

Export recordset to Excel

Public Function ExportRecordsetToExcel(ByVal pvRs As ADODB.Recordset, _ ByVal pvXls As Excel.Worksheet, _ ByVal pvStartRow As Integer, _ Optional ByVal pvStartCol As Integer = 1) As Long Dim nRows As Integer Dim nCols As Integer nRows = pvRs.RecordCount nCols = pvRs.Fields.Count With pvXls .Cells(pvStartRow, pvStartCol).CopyFromRecordset pvRs .Range(.Cells(pvStartRow, pvStartCol), .Cells(pvStartRow + nRows, pvStartCol + nCols)).CurrentRegion.Borders.LineStyle = xlContinuous End With ExportRecordsetToExcel = pvStartRow + nRows End Function