|
Hi,
I have to fix an issue of a windows application. In my app I have to allow user to print report. Application should print record and each page must have 86 lines and each line consist of 134 characters. I have more then 86 records but its printing only 1 record. My code is :
PrintDialog printDialog;
PrintDocument printDocument;
for (int iCtr = 0; iCtr < intPageCount; iCtr++)
{
// this ProcessTransaction_82210() runs a COBOL program which returns formated record which
// contains 86 lines per page and each line contains 134 characters and here I am
// concatinating all the records to a string variable strPrint.
strPrint1 = ProcessTransaction.ProcessTransaction_82210(iCtr);
strPrint += strPrint1;
if (string.IsNullOrEmpty(strPrint.Trim()))
{
break;
}
}
try
{
printDialog.Document = printDocument;
printDocument.PrintPage += new PrintPageEventHandler(onPrintPage);
}
catch (Exception exc)
{
MessageBox.Show(exc.Message.ToString());
}
if (printDialog.ShowDialog() == DialogResult.OK)
{
printDocument.Print();
}
private void onPrintPage(object sender, PrintPageEventArgs e)
{
Graphics g = e.Graphics;
int x = e.MarginBounds.Left - 50;
int y = e.MarginBounds.Top - 50;
System.Drawing.Brush brush = new System.Drawing.SolidBrush(Color.Black);
try
{
g.DrawString(strPrint, new System.Drawing.Font("Courier New", 8, System.Drawing.FontStyle.Regular),brush, x, y);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
}
But the application is printing only 1 page. Can any one please let me know how to print same number of pages as in string/document. ProcessTransaction_82210() method also return Page nbr along with records.
we need to set e.HasMorePages = true but how to know it has more pages.
Please let me know the code how to print more nbr of pages. Its very urgent.
Best Regards,
Chandan Kumar
|
|
|
|
|
I can't actually see anything in your onPrintPage method about e.HasMorePages = true. Without this, the print will think that it has actually finished.
|
|
|
|
|
I had records which requires 2 pages to be printed , however when I pass e.HasMorePages = true; then it starts printing so many pages. it displays a dialog "printing 140 of document". how can I intimate printer that I have 2 pages to print.
Best Regards,
Chandan Kumar
|
|
|
|
|
|
Hi all,
I hope this would be the correct place to post this question, if not please advise.
I would like to know what files is required or what installation is required when using Crystal Reporting?
Many thanks in advance
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Hey there, which IDE are you using?
i use visual studio 2008 and there are (as far as i know) no extra files needed with your binary...
the report itself has an rpt file extention but this is the same concept as every form having is own cs file.
if your new to crystal i sugest you get a book because there arent many resources worth looking into on the net that ive found! but this all depends on the level of reports you need to create
ive just ordered this book for myself Click me[^]
good luck
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
|
Hi
I have a datatable having 10 records. I want to insert the 10 records to a table in a database using stroed procedure from my front end C#. How to do? can any one help me please?
Thanks in advance
kesavan
kesavan
|
|
|
|
|
Write a stored procedure to insert 1 row. Then call that stored procedure once for each of the rows you which to insert.
If they have to be done together, do the whole thing inside a transaction.
Simon
|
|
|
|
|
Write the stored procedure to accept an xml parameter. Send all 10 records as xml and unpack in the stored proc to insert them.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
|
Hi,
Curretly i am doing some operations on tables of oracle 9i database using oracle connections and commands by using the namespace "System.Data.OracleClient" i want to know which provider is used internally by the .Net for the database operations with this namespace and by the by client version of oracle on my system is 10g.
Thanks in Advance.
|
|
|
|
|
hi i try to add sorted field on my report in my application and find this code :
<br />
DatabaseFieldDefinition crDatabaseFieldDefinition = rp.Database.TablesItem[0].Fields[0];<br />
rp.DataDefinition.SortFields.Item[0].Field(crDatabaseFieldDefinition);<br />
it work correctly..
i try to add multiple sort field ...but in my application the crystall reportviewer only sort report on first fild...
can any one know that how i add multiple sort fields on crystal reports in my application?
thnx
|
|
|
|
|
Hello,
VS 2008
I am calling native C++ dll from C#.Net 3.5. The program works ok, and I am very new at doing this. I am just wondering if there a better method to use. I will have to make many call backs in my project from native C++. So I am looking for a efficient method to handle the call back to make it easier to maintain and add more call backs. And to call these from .net. Is there a way to have a middle layer to bridge between .Net and C++? Just guessing here.
My code is below, this is just a simple that return a int from a call back.
Many thanks,
typedef void (__stdcall *ptrToAge)(int); <br />
MOBILEDLL_API char* GetName(char* name); <br />
<br />
void GetMyAge(ptrToAge cb) <br />
{ <br />
cb(28); <br />
} <br />
<br />
private delegate void TestCallbackDelegate(); <br />
[DllImport("MobileDLL.dll")] <br />
static extern void TestCallback(TestCallbackDelegate callbackTest); <br />
<br />
void OnGetMyAge(int age) <br />
{ <br />
this.label1.Text = age.ToString(); <br />
} <br />
<br />
GetMyAge((GetMyAgeDelegate) OnGetMyAge);<br />
|
|
|
|
|
I have to write an application theat reads big files performs some processing on there data like XOR on a some section in it each section is a few maga bytes and then save them to A new file
waht should i do in order to achive max performance?
shoul i read a few sections eaach time and process and append them to the new file or one section each time?
there are several threads that do this proces on several different files at the same time?
sample code will be great help
Thnks
|
|
|
|
|
poqeqw wrote: waht should i do in order to achive max performance?
The limiting factor here is probably the drive speed. Getting the data into RAM is what is going to take the longest. simply XORing the data is insignificant in comparison to how long it will take to load/save the data, so don't mess around with separate threads for processing the data, you'll be wasting your time.
you can use System.IO.File.ReadAllBytes(@"C:\myfile"); to get the whole file. and System.IO.File.WriteAllBytes(@"c;\myfile", thedata); to save the processed data. I'd start by doing it like this. Stick some timers in a time how long the load takes, how long the save take and how long the processing takes. There is nothing you can do to speed up the load/save (apart from buy faster drives).
However, if the processing time is significant, you could start the processing while still loading the file. You could do this by doing the read on a seperate thread like this:
System.IO.FileStream myStream = new System.IO.FileStream(@"c;\myfile", System.IO.FileAccess.Read);
myStream.BeginRead(...);
and allowing the main thread to start processing while the read is still taking place. You'll have to put checks in place to make sure the main thread doesn't get ahead of the data being read.
(Don't bother using threads to do several files at the same time, the drive will only thrash about and read time will actually be slower. focus on doing them sequentially. Remember the limiting factor here is almost certainly the drive access. Unless of course they are on separate drives, or you are doing some really heavy cpu intensive processing)
Simon
|
|
|
|
|
Hi,
I am develping a web project in c#.net 1.1. The application reads an xml file which is stored in the application directory. This xml file is a thirdparty xml from internet. They will update this xml in every point of time (ie: currency xml). In this case, I need a scheduled download of the file from the internet to my application directory. Please guide me on how to achieve this. Thanks.
I would like to appreciate all the techies providing wonderful solutions to all the queries in this website.
Thanks
rijz
|
|
|
|
|
You want a program that downloads a file at specific intervals automatically? Go for a Windows service.
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
|
Hello everyone,
I am writing XQuery based on an XML file. I am using instance type of XPathDocument, XPathNavigator, XPathExpression and XPathNodeIterator.
My question is does any of them need to be released to free resource? I have not found any Close/Dispose methods for them. It is so strange to me since at least the XML file to be queried needs to be closed.
thanks in advance,
George
|
|
|
|
|
When you load XML file, it loads the contents to memory and free the file handles. So no need to close it externally.
|
|
|
|
|
Thanks N a v a n e e t h,
You mean when we create an XPathDocument, the load file content, parse and close work is done internally? So, no need to care about further manualy work to close or release any resource?
regards,
George
|
|
|
|
|
|
Thanks N a v a n e e t h,
Question answered.
regards,
George
|
|
|
|
|
Hi friends
I am working in windows applications (C#)...In my project i am using UltraGrid..
In that grid there are 3 bands(Country ,State and city...State is below the country and the city is below the state)...Each band consists of 12 columns...Also Each column of all the bands contains its own column headers...Then in my ultragrid i have enabled column moving and column swapping options with the following code:
SFOMainScreen_grpBoxMainDetails_ugDetails.DisplayLayout.Bands[2].Override.AllowColMoving =
AllowColMoving.Default;
SFOMainScreen_grpBoxMainDetails_ugDetails.DisplayLayout.Bands[2].Override.AllowColSwapping =
AllowColSwapping.Default;
so in my ultragrid all the 3 bands with its column headers are displayed when running the application... I can move and swap the columns of all the bands when the column headers of each bands are made visible..According to my requirement, i Just make the country column headers(All column headers of first Band (ie) Country Band) as the visible one and
the column headers of rest of the bands( state and City) as the invisible one...
For the above case,
My requirement is When the column headers of first band is moved then along with the column of first band(country Band) corresponding columns of the state and city bands which are in the band 2 and band 3 respectively can also be moved..I need the C# Source code for the above requirement...Any known friends help me..... Thanks in advance kawin...
r
|
|
|
|