|
Look at the actual code you showed us.
Where in that does it actually print or print preview anything? what part of that code actually causes a print preview to appear on the screen?
Have a good close look. I'll wait.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
when I click on the button: prnt_btn I call on my function :report {}
it means i have a button wich call my report
|
|
|
|
|
This has "long day" written all over it ...
I'm sure that you do. But which line of code in the fragment you showed us actually does the print preview?
Now, I'm guessing - and guessing is all I can do here, since I can't see your screen, access your HDD, or read your mind: we only get exactly what you type to work with - that it's one of these:
c2.SetDataSource(dt);
crystalReportViewer1.ReportSource = c2;
c2.SetDatabaseLogon("sa", "789456");
Or possibly something that happens after the call to the report method.
But ... I don't have the code for your FactCons class. I don't have the code that calls report . So I need you to actually do the work and find out - because without it, there isn't anything I can do, other than bang my head on the desk because it "feels so good when I stop" ...
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
dt.Load(dtr);
FactCons c2 = new FactCons();
c2.SetDataSource(dt);
crystalReportViewer1.ReportSource = c2;
c2.SetDatabaseLogon("sa", "123456");
|
|
|
|
|
desk *bang*
desk *bang*
desk *bang*
Ahhhh ...
Is there any point in me typing anything? Since you don't seem to be listening at all?
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
at least my code print invoice by previewing, but as i speak french may be i don't catch you, all my codes work correctly and till now we use and print the invoice with crystal by previewing when call the method report...... but what you said i don't find idea in my question. my method report works
|
|
|
|
|
Yes, but the code which actually does the "heavy lifting" is part of your FactCons class which we have no access to!
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
You need to understand when you are beaten.
|
|
|
|
|
I'm trying to avoid getting to the "never argue online with idiots and script kiddies" moment.
I genuinely think he has no idea what he is doing, and is trying to cover that up with a lack of thinking. We'll get there ... probably.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
sorry about your way of thinking, why insult when yourself do not understand a request?OriginalGriff wrote:
I genuinely think he has no idea what he is doing
sorry,try to read the last proposition that is what i was asking as RobF_83 he gave an answer corect
|
|
|
|
|
private void butt_prnt_Click(object sender, EventArgs e)
{
report();
}
void report()
{
cnx = new SqlConnection(db.RXcon);
try
{
cnx.Open();
string cg=" SELECT * from Consultation where NumFact=" + @Convert.ToInt32(textBox4.Text);
commd2 = new SqlCommand(cg);
commd2.Connection = cnx;
DataSet dts = new DataSet();
DataTable dt = new DataTable();
dtr = commd2.ExecuteReader();
dt.Load(dtr);
FactCons c2 = new FactCons();
c2.SetDataSource(dt);
crystalReportViewer1.ReportSource = c2;
c2.SetDatabaseLogon("sa", "789654");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
cnx.Close();
}
|
|
|
|
|
crystalReportViewer1.ReportSource = c2; is the line that actually loads the report into the report control.
You need to replace that with this:
c2.PrintToPrinter(1, true, 0, 0)
You should also place it AFTER
c2.SetDatabaseLogon("sa", "789654");
|
|
|
|
|
thank you alot you has understood my request, i'll give you the result tomorrow
RobF_83 wrote: is the line that actually loads the report into the report control.
You need to replace that with this:
c2.PrintToPrinter(1, true, 0, 0)
You should also place it AFTER
c2.SetDatabaseLogon("sa", "789654");
|
|
|
|
|
Thank you verry much RobF_83
here is solution
void report()
{
cnx = new SqlConnection(db.RXcon);
try
{
cnx.Open();
string cg=" SELECT * from Consultation where NumFact=" + @Convert.ToInt32(textBox4.Text);
commd2 = new SqlCommand(cg);
commd2.Connection = cnx;
DataSet dts = new DataSet();
DataTable dt = new DataTable();
dtr = commd2.ExecuteReader();
dt.Load(dtr);
FactCons c2 = new FactCons();
c2.SetDataSource(dt);
crystalReportViewer1.ReportSource = c2;
c2.SetDatabaseLogon("sa", "765432");
c2.PrintToPrinter(1, true,0, 0);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
cnx.Close();
}
|
|
|
|
|
thanks in advance
modified 22-Aug-19 22:17pm.
|
|
|
|
|
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.
So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
I need a playlist creater aplication using Pvs.Av Player.
In my form 4 buttons added.Frist one Open Files
second one Save playlist Third one Open playlist Fourth one Delete Playlist.
When i am clicking open files button should be add some video files in my playlist,and show file name and path time and date show in data grid view.
When i am clicking save button to show save dialog box and save playlist with file extention *.pll
when i am double clicking in file name in data grid to play the video in preview panel.
modified 22-Aug-19 2:16am.
|
|
|
|
|
This is not a job site; we do not hire out here.
Even if we did, we'd need a whole load more information than "I need a programmer" - that's like saying "I need a surgeon": what type? Brain? Bone? Heart? Transplant? Cosmetic?
What do you need done?
If you want someone to write your code, you have to pay - I suggest you go to Freelancer.com and ask there.
But be aware: you get what you pay for. Pay peanuts, get monkeys.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
sorry,It was caused by my ignorance.
|
|
|
|
|
How can I do this Excel's MOD formula in C#:
=MOD(-1.779406909, 2 * PI())
Thanks,
Jassim
www.softnames.com
|
|
|
|
|
You put % between the numbers.
|
|
|
|
|
I tried that..
Excel returns
4.503778398
This is the figure I am trying to achieve
But...
double bearing4 = Math.Floor(-1.7794 / (2 * Math.PI));
returns -1
and this:
double bearing4 = -1.779406909 % (2 * Math.PI);
returns: -1.779406909
www.softnames.com
|
|
|
|
|
Modulo and negative numbers make an explosive mix. See the last table in Modulo operation - Wikipedia[^].
One common trick is to do something like
result = (a + n*b) % b where n is some "sufficiently large" integer.
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
double bearing4 = (-1.779406909 + 2 * Math.PI) % Math.PI;
It returns 1.362 which is different that Excel
www.softnames.com
|
|
|
|