Click here to Skip to main content
15,910,877 members
Home / Discussions / C#
   

C#

 
GeneralHave Problem while invoking a method in C# Web Services Pin
grace_at_canada31-May-05 10:36
grace_at_canada31-May-05 10:36 
GeneralRe: Have Problem while invoking a method in C# Web Services Pin
grace_at_canada31-May-05 10:55
grace_at_canada31-May-05 10:55 
GeneralRe: Have Problem while invoking a method in C# Web Services Pin
grace_at_canada1-Jun-05 3:37
grace_at_canada1-Jun-05 3:37 
GeneralDataRow elements datetime problem Pin
parrot12331-May-05 10:26
parrot12331-May-05 10:26 
GeneralRe: DataRow elements datetime problem Pin
Robert Rohde31-May-05 10:46
Robert Rohde31-May-05 10:46 
GeneralRe: DataRow elements datetime problem Pin
parrot1231-Jun-05 2:12
parrot1231-Jun-05 2:12 
GeneralC# Printable Reports from Access DB Pin
Glenn E. Lanier II31-May-05 10:24
Glenn E. Lanier II31-May-05 10:24 
GeneralRe: C# Printable Reports from Access DB Pin
KaptinKrunch31-May-05 19:04
KaptinKrunch31-May-05 19:04 
Hope this helps. You may need to change it a bit to meet your needs such as the Access version, but here are 2 routines that 1 prints directly and the other does a preview.
The reports are created in access then these call upon those report names.
Also it's in vb.net !sorry! but I also read/write C# and thought that this might be helpful to you.

Private Sub Print_Report(ByVal _report As String)
'Prints the "Routing Report" in ticketaccess.mdb.

' Enable an error handler for this procedure:
On Error GoTo ErrorHandler

'Dim oAccess As Access.Application

'path to ticketaccess.mdb file
Dim cfg As ConfigInfo = GetConfig
Dim sDBPath As String = cfg.databasepath
Dim sReport As String = _report 'name of report to print"

' Start a new instance of Access for automation:
'oAccess = New Access.Application()
Dim oAccess = CreateObject("Access.application.8")

' Determine the path to ticketaccess.mdb:
'sDBPath = oAccess.SysCmd(Action:=Access.AcSysCmdAction.acSysCmdAccessDir)
'sDBPath = sDBPath & "ticketaccess.mdb"

' Open ticketaccess.mdb in shared mode:
oAccess.OpenCurrentDatabase(filepath:=sDBPath, Exclusive:=False)

' Select the report name in the database window and give focus
' to the database window:
oAccess.DoCmd.SelectObject(ObjectType:=Access.AcObjectType.acReport, _
ObjectName:=sReport, InDatabaseWindow:=True)

' Print the report:
oAccess.DoCmd.OpenReport(ReportName:=sReport, _
View:=Access.AcView.acViewNormal)

Cleanup:
' Quit Access and release object:
On Error Resume Next
oAccess.Quit(Option:=Access.AcQuitOption.acQuitSaveNone)
System.Runtime.InteropServices.Marshal.ReleaseComObject(oAccess)
oAccess = Nothing

Exit Sub
ErrorHandler:
MsgBox(Err.Number & ": " & Err.Description, _
MsgBoxStyle.MsgBoxSetForeground, "Error Handler")
' Try to quit Access due to an unexpected error:
Resume Cleanup
End Sub 'Uses report in access db

Private Sub Preview_Report(ByVal _report As String)
'Previews the "Summary of Sales by Year" report in ticketaccess.mdb.

' Enable an error handler for this procedure:
On Error GoTo ErrorHandler

'Dim oAccess As Access.Application
Dim oForm As Access.Form
'path to ticketaccess.mdb file
Dim cfg As ConfigInfo = GetConfig
Dim sDBPath As String = cfg.databasepath
Dim sReport As String = _report 'name of report to preview

' Start a new instance of Access for automation:
'oAccess = New Access.ApplicationClass()

Dim oAccess = CreateObject("Access.Application.8")

' Make sure Access is visible:
If Not oAccess.Visible Then oAccess.Visible = True

' Determine the path to ticketaccess.mdb:
'sDBPath = oAccess.SysCmd(Action:=Access.AcSysCmdAction.acSysCmdAccessDir)
'sDBPath = sDBPath & "ticketAccess.mdb"

' Open ticketaccess.mdb in shared mode:
oAccess.OpenCurrentDatabase(filepath:=sDBPath, Exclusive:=False)

' Close any forms that ticketaccess may have opened:
For Each oForm In oAccess.Forms
oAccess.DoCmd.Close(ObjectType:=Access.AcObjectType.acForm, _
ObjectName:=oForm.Name, _
Save:=Access.AcCloseSave.acSaveNo)
Next
If Not oForm Is Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(oForm)
End If
oForm = Nothing

' Select the report name in the database window and give focus
' to the database window:
oAccess.DoCmd.SelectObject(ObjectType:=Access.AcObjectType.acReport, _
ObjectName:=sReport, InDatabaseWindow:=True)

' Maximize the Access window:
oAccess.RunCommand(Command:=Access.AcCommand.acCmdAppMaximize)
'oAccess.RunCommand(Command:=Access.AcCommand.acCmdAppMinimize)

' Preview the report:
oAccess.DoCmd.OpenReport(ReportName:=sReport, _
View:=Access.AcView.acViewPreview)

' Maximize the report window:
oAccess.DoCmd.Maximize()

' Hide Access menu bar:
oAccess.CommandBars("Menu Bar").Enabled = False

' Hide Report's Print Preview menu bar:
oAccess.CommandBars("Print Preview").Enabled = False

' Hide Report's right-click popup menu:
'oAccess.CommandBars("Print Preview Popup").Enabled = False

' Release Application object and allow Access to be closed by user:
If Not oAccess.UserControl Then oAccess.UserControl = True
System.Runtime.InteropServices.Marshal.ReleaseComObject(oAccess)
oAccess = Nothing

Exit Sub
ErrorCleanup:
' Try to quit Access due to an unexpected error:
On Error Resume Next
System.Runtime.InteropServices.Marshal.ReleaseComObject(oForm)
oForm = Nothing
oAccess.Quit(Option:=Access.AcQuitOption.acQuitSaveNone)
System.Runtime.InteropServices.Marshal.ReleaseComObject(oAccess)
oAccess = Nothing

Exit Sub
ErrorHandler:
MsgBox(Err.Number & ": " & Err.Description & "- -" & sDBPath, _
MsgBoxStyle.MsgBoxSetForeground, "Error Handler")
Resume ErrorCleanup
End Sub ' Uses report in access db
GeneralRe: C# Printable Reports from Access DB Pin
Glenn E. Lanier II1-Jun-05 3:01
Glenn E. Lanier II1-Jun-05 3:01 
GeneralRe: C# Printable Reports from Access DB Pin
Anonymous2-Jun-05 6:14
Anonymous2-Jun-05 6:14 
GeneralRe: C# Printable Reports from Access DB Pin
Glenn E. Lanier II2-Jun-05 6:32
Glenn E. Lanier II2-Jun-05 6:32 
GeneralRe: C# Printable Reports from Access DB Pin
KaptinKrunch2-Jun-05 16:14
KaptinKrunch2-Jun-05 16:14 
GeneralRe: C# Printable Reports from Access DB Pin
Glenn E. Lanier II6-Jun-05 6:57
Glenn E. Lanier II6-Jun-05 6:57 
GeneralI'm Totally Stumped - DirectDraw C# Surfaces Pin
YawgmothIII31-May-05 8:59
YawgmothIII31-May-05 8:59 
GeneralRe: I'm Totally Stumped - DirectDraw C# Surfaces Pin
Christian Graus31-May-05 11:53
protectorChristian Graus31-May-05 11:53 
GeneralRe: I'm Totally Stumped - DirectDraw C# Surfaces Pin
Anonymous31-May-05 12:42
Anonymous31-May-05 12:42 
GeneralRe: I'm Totally Stumped - DirectDraw C# Surfaces Pin
Christian Graus31-May-05 12:50
protectorChristian Graus31-May-05 12:50 
GeneralRe: I'm Totally Stumped - DirectDraw C# Surfaces Pin
Anonymous31-May-05 15:04
Anonymous31-May-05 15:04 
GeneralRe: I'm Totally Stumped - DirectDraw C# Surfaces Pin
Christian Graus31-May-05 15:21
protectorChristian Graus31-May-05 15:21 
Generalusing windows' auto complete Pin
Green Fuze31-May-05 8:43
Green Fuze31-May-05 8:43 
GeneralRe: using windows' auto complete Pin
OMalleyW31-May-05 9:00
OMalleyW31-May-05 9:00 
GeneralRe: using windows' auto complete Pin
Green Fuze31-May-05 12:35
Green Fuze31-May-05 12:35 
QuestionVideo Buffer? Pin
OMalleyW31-May-05 8:13
OMalleyW31-May-05 8:13 
AnswerRe: Video Buffer? Pin
OMalleyW1-Jun-05 7:16
OMalleyW1-Jun-05 7:16 
GeneralLooking for MS Word AutoShape like Toolbar Pin
Don Ashworth31-May-05 7:56
Don Ashworth31-May-05 7:56 

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.