Click here to Skip to main content
15,898,134 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Visual Basic 6.0 Pin
CPallini17-Dec-07 3:23
mveCPallini17-Dec-07 3:23 
GeneralRe: Visual Basic 6.0 Pin
Paul Conrad23-Dec-07 14:03
professionalPaul Conrad23-Dec-07 14:03 
Questionwhat is eguivalent in c# for CShort in vb...? Pin
tasumisra16-Dec-07 23:36
tasumisra16-Dec-07 23:36 
AnswerRe: what is eguivalent in c# for CShort in vb...? Pin
Ashish Kumar Vyas16-Dec-07 23:58
Ashish Kumar Vyas16-Dec-07 23:58 
GeneralRe: what is eguivalent in c# for CShort in vb...? Pin
CKnig17-Dec-07 2:36
CKnig17-Dec-07 2:36 
AnswerRe: what is eguivalent in c# for CShort in vb...? Pin
Dave Doknjas17-Dec-07 14:30
Dave Doknjas17-Dec-07 14:30 
Generalproblem in importing table into Excel Pin
poonams16-Dec-07 22:59
poonams16-Dec-07 22:59 
GeneralRe: problem in importing table into Excel Pin
Ashish Kumar Vyas16-Dec-07 23:39
Ashish Kumar Vyas16-Dec-07 23:39 
Hi,
I am also using same thing in mine project, however I don't have enough time to look into your code but I am sending u mine code so it will be easy for u to check it out what was wrong with your code.mine code is error free. let u try it.........

Imports Microsoft.VisualBasic
Imports Excel
Imports System
Imports com.lowagie.text
Imports com.lowagie.text.Image
Imports pdfWriter = com.lowagie.text.pdf.PdfWriter
Imports com.lowagie.text.pdf.PdfPTable
Imports java.io

Public Const vbCenter = 2
Public Const vbRightJustify = 1
Public Const vbLeftJustify = 0
'/* Master Report Section Start * /
Public Function BranchMaintenanceReport(ByVal strSearchText As String, Optional ByVal strUserNo As String = "") As String
Dim objXL As New Excel.Application, wbXL As Excel.Workbook, wsXL As Excel.Worksheet
Dim intRow As Long, intCol As Long, intColCount As Long, intSNo As Long
Dim rs As New ADODB.Recordset, SQL As String
'Dim st As New ADODB.Stream
Dim psUtil As New PensionSystemUtil
Dim ctr As Integer
Dim tempDir As String, fileName As String, filePath As String
fileName = ""
intRow = 0
intColCount = 3
wbXL = objXL.Workbooks.Add
Try
'intRow = intRow + 1
'wsXL.Range(wsXL.Cells(1, 1), wsXL.Cells(1, intColCount)).Merge()
'SQL = "select * from sa_company_logo where company_code='" & p_company & "'"
'psUtil.ConnectToHDDB()
'rs = New ADODB.Recordset
'rs.Open(SQL, psUtil.conHD, 2, 3)
'If Not rs.EOF Then
' st = New ADODB.Stream
' st.Open()
' st.Type = ADODB.StreamTypeEnum.adTypeBinary
' st.Write(rs.Fields("company_logo").Value)
' If psUtil.IsPathExists(tempDir + "\CompanyLogo.jpg") Then
' psUtil.KillFile(tempDir + "\CompanyLogo.jpg")
' End If
' st.SaveToFile(tempDir + "\CompanyLogo.jpg", ADODB.SaveOptionsEnum.adSaveCreateOverWrite)
' wsXL.Shapes.AddPicture(tempDir + "\CompanyLogo.jpg", _
' Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoCTrue, 0, 0, 650, 100)
' wsXL.Rows(1).RowHeight = wsXL.Shapes.Item(1).Height
' st = Nothing
'Else
'End If

'intRow = intRow + 1
''-> Cell 3,1 Report Name and Report Period
'SetFont("Branch Maintenance Report ", "Arial", 16777215, True, False, False, 16, vbCenter, 16711680, wsXL, 3, 1)
'wsXL.Range(wsXL.Cells(2, 1), wsXL.Cells(2, intColCount)).Merge()

If psUtil.ConnectToPFDB Then
tempDir = System.Configuration.ConfigurationManager.AppSettings("applicationHome") + _
System.Configuration.ConfigurationManager.AppSettings("tempDir") + strUserNo
If Not psUtil.IsPathExists(tempDir, True) Then
psUtil.MakeDir(tempDir)
End If
For ctr = 1 To wbXL.Sheets.Count - 1
wbXL.Sheets(ctr).Delete()
Next

wsXL = objXL.ActiveSheet
wsXL.Name = "BranchMaintenanceReport"

'-> Header Rows
intRow = intRow + 1
wsXL.Cells(intRow, 1).Value = "S.No."
wsXL.Cells(intRow, 2).Value = "Branch Code"
wsXL.Cells(intRow, 3).Value = "Branch Name"

For intCol = 1 To intColCount
wsXL.Cells(intRow, intCol).BorderAround(Excel.XlLineStyle.xlContinuous, XlBorderWeight.xlMedium, XlColorIndex.xlColorIndexAutomatic)
Next

SQL = "SELECT Branch_Code, Branch_Name FROM Branches WHERE (Deleted <> 'Y' OR Deleted IS NULL) "
If strSearchText <> "" Then
SQL += "AND Branch_Name LIKE ('" + strSearchText + "%') "
End If
SQL += "ORDER BY Branch_Name"

rs = New ADODB.Recordset
rs.Open(SQL, psUtil.conPF, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockReadOnly)
intSNo = 0
Do While Not rs.EOF
intRow = intRow + 1
For intCol = 1 To intColCount
wsXL.Cells(intRow, intCol).BorderAround(Excel.XlLineStyle.xlContinuous, XlBorderWeight.xlMedium, XlColorIndex.xlColorIndexAutomatic)
Next
intSNo = intSNo + 1
wsXL.Cells(intRow, 1).Value = intSNo
wsXL.Cells(intRow, 2).Value = rs("Branch_Code").Value.ToString
wsXL.Cells(intRow, 3).Value = Trim(rs("Branch_Name").Value.ToString)
rs.MoveNext()
Loop

wsXL.Columns(1).columnWidth = 5
wsXL.Columns(2).columnWidth = 11
wsXL.Columns(3).columnWidth = 50

wsXL.Range(wsXL.Cells(1, 1), wsXL.Cells(intRow, 3)).WrapText = True
wsXL.Range(wsXL.Cells(1, 1), wsXL.Cells(intRow, 3)).VerticalAlignment = Excel.XlVAlign.xlVAlignTop
wsXL.PageSetup.CenterFooter = "Page &P of &N"
wsXL.PageSetup.LeftFooter = strUserNo
wsXL.PageSetup.RightFooter = Format(Now, "dd-MMM-yyyy HH:mm")
wsXL.PageSetup.Orientation = Excel.XlPageOrientation.xlPortrait
wsXL.PageSetup.PrintTitleRows = "$1:$1"
wsXL.PageSetup.Zoom = 70
'-> No Report Means Nil...
If intRow = 1 Then
intRow = intRow + 1
For intCol = 1 To intColCount
wsXL.Cells(intRow, intCol).BorderAround(Excel.XlLineStyle.xlContinuous, XlBorderWeight.xlMedium, XlColorIndex.xlColorIndexAutomatic)
Next
wsXL.Cells(intRow, 2).Value = "NIL"
Else
End If
fileName = "BranchMaintenanceReport-" + Format(Now, "dd-MMM-yyyy") + ".xls"
filePath = tempDir + "\" + fileName
If psUtil.IsPathExists(filePath) Then
psUtil.KillFile(filePath)
End If
wsXL.SaveAs(filePath)
Else
Throw New Exception("DB Connection Error")
End If
Catch ex As Exception
Throw ex
Finally
wbXL.Close(False)
objXL.Quit()
psUtil.CloseConnectionPF()
End Try
BranchMaintenanceReport = fileName
End Function


thanks
ashish
GeneralSplitter control in vb.net2005 Pin
VB 8.016-Dec-07 22:43
VB 8.016-Dec-07 22:43 
Generalimage combo in vb.net Pin
Deepthy.P.M16-Dec-07 22:40
Deepthy.P.M16-Dec-07 22:40 
GeneralRe: image combo in vb.net Pin
John_Adams17-Dec-07 8:07
John_Adams17-Dec-07 8:07 
GeneralXML Comments Pin
danasegaranea16-Dec-07 21:43
danasegaranea16-Dec-07 21:43 
GeneralRe: XML Comments Pin
CKnig16-Dec-07 21:46
CKnig16-Dec-07 21:46 
GeneralRe: XML Comments Pin
danasegaranea16-Dec-07 21:52
danasegaranea16-Dec-07 21:52 
GeneralRe: XML Comments Pin
CKnig16-Dec-07 22:21
CKnig16-Dec-07 22:21 
GeneralRe: XML Comments Pin
danasegaranea16-Dec-07 22:35
danasegaranea16-Dec-07 22:35 
GeneralRe: XML Comments Pin
CKnig16-Dec-07 23:00
CKnig16-Dec-07 23:00 
GeneralRe: XML Comments Pin
Kevin McFarlane17-Dec-07 6:10
Kevin McFarlane17-Dec-07 6:10 
GeneralImage ComboBox Control in VB.NET Pin
Deepthy.P.M16-Dec-07 21:30
Deepthy.P.M16-Dec-07 21:30 
GeneralRe: Image ComboBox Control in VB.NET Pin
CKnig16-Dec-07 21:42
CKnig16-Dec-07 21:42 
GeneralRe: Image ComboBox Control in VB.NET Pin
Deepthy.P.M16-Dec-07 22:12
Deepthy.P.M16-Dec-07 22:12 
GeneralRe: Image ComboBox Control in VB.NET Pin
CKnig16-Dec-07 22:20
CKnig16-Dec-07 22:20 
QuestionHow to encrypt a string using rijndael algorithm Pin
Nagaraj.k16-Dec-07 21:11
Nagaraj.k16-Dec-07 21:11 
GeneralRe: How to encrypt a string using rijndael algorithm Pin
CKnig16-Dec-07 21:35
CKnig16-Dec-07 21:35 
QuestionRe: How to encrypt a string using rijndael algorithm Pin
Nagaraj.k17-Dec-07 1:22
Nagaraj.k17-Dec-07 1:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.