|
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
|
|
|
|
|
Jassim Rahma wrote: which is different that Excel
which is because you're calculating something different.
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
MOD in Excel is a true Modulus: % in C# is a remainder, and the two are not the same: Mod and Remainder are not the Same – Rob Conery[^]
What you need is to write a modulus method:
private double Mod(double a, double b)
{
return a - b * Math.Floor(a / b);
}
Call that, and you'll get the answer you're expecting.
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!
|
|
|
|
|
Yes Yes Yes
Thank you so much
www.softnames.com
|
|
|
|
|
You're welcome!
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!
|
|
|
|
|
Also useful background: Eric Lippert "What’s the difference? Remainder vs Modulus" [^]
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
what I use:
using System;
using System.Runtime.InteropServices.WindowsRuntime;
namespace Utilities
{
public static class MathExtensions
{
public static double ModT<T>(this T i1, T i2)
{
double v1 = i1.GetDouble();
double v2 = i2.GetDouble();
return v1 - v2 * Math.Floor(v1 / v2);
}
public static double ModT1T2<T1, T2>(this T1 i1, T2 i2)
{
double v1 = i1.GetDouble();
double v2 = i2.GetDouble();
return v1 - v2 * Math.Floor(v1 / v2);
}
public static double GetDouble<T>(this T i1)
{
double v1;
try
{
v1 = Convert.ToDouble(i1);
}
catch (InvalidCastException iex)
{
throw new InvalidCastException($"type {typeof(T)} cannot be cast to double: {iex.Message}");
}
catch (FormatException fex)
{
throw new FormatException($"type {typeof(T)} cannot be used: {fex.Message}");
}
catch (OverflowException oex)
{
throw new OverflowException($"type {typeof(T)} result is an overflow: {oex.Message}");
}
return v1;
}
}
} Tests:
double dbl = -1.779406909.ModT(2 * Math.PI);
double int1 = 221.ModT(20);
double sngl = 102.0f.ModT(20.0f);
double deci = 102.0m.ModT(20.0m);
double intdecicombo = 100.0.ModT1T2(34.56m);
double dbl2 = 100.0.ModT(34.56);
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
BillWoodruff wrote:
catch (InvalidCastException iex)
{
throw new InvalidCastException($"type {typeof(T)} cannot be cast to double: {iex.Message}");
} If you're going to wrap an exception, you should pass the wrapped exception as the inner exception.
You should probably review the error messages as well. For example, it might be fine to use the given type, but not the specified value.
catch (InvalidCastException iex)
{
throw new InvalidCastException($"Type {typeof(T)} cannot be cast to double: {iex.Message}", iex);
}
catch (FormatException fex)
{
throw new FormatException($"Value '{i1}' of type {typeof(T)} cannot be converted to a double: {fex.Message}", fex);
}
catch (OverflowException oex)
{
throw new OverflowException($"Value '{i1}' of type {typeof(T)} is too large for a double: {oex.Message}", oex);
} You can also eliminate the InvalidCastException by adding a generic type constraint, since the documentation[^] says it's only thrown if the value to convert doesn't implement IConvertible :
public static double ModT<T>(this T i1, T i2) where T : IConvertible { ... }
public static double ModT1T2<T1, T2>(this T1 i1, T2 i2) where T1 : IConvertible where T2 : IConvertible { ... }
public static double GetDouble<T>(this T i1) where T : IConvertible { ... }
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|