|
|
Console.WriteLine("Number of calculations: ");
ntries = Convert.ToInt32(Console.ReadLine());
for(int x = 0; x < ntries; x++)
{
}
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|
Hello, I am creating a simple program in Framework to calculate the area of a triangle.
But the problem is, I can't enter a decimal number and the result is not a decimal number either. How should I solve this?
|
|
|
|
|
Use decimal.TryParse[^] to convert it from a string to a decimal value.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hi, I'
modified 5-Dec-20 8:33am.
|
|
|
|
|
Read the string into a variable.
Then use string.Substring[^] to break it into three strings: one fro the day, one for the month, and one for the year.
Hint:
string s = "01092000";
string month = s.Substring(2, 2);
...
Then use int.TryParse[^] to convert each part to a numeric value.
Hint:
int mon;
if (!int.TryParse(month, out mon))
{
... Report problem to user ...
return;
} Then use the DateTime constructor[^] to make a valid date
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Can you give me please the full code for the program? I don't understand programming
|
|
|
|
|
Sorry ... but if you don't understand programming and you are also not willing to try something - what are you trying to achieve ?
|
|
|
|
|
I missed some classes at school because I had corona. In those lessons they started programming, but I have never programmed. So I really don't know where to start.
|
|
|
|
|
Then you go back to your teacher and you ask for help - he knows you had Covid-19, so he knows you weren't just sitting around playing video games during a lockdown when you should have been studying.
But us just giving you the code doesn't help you at all in the long term, it makes it a lot worse!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Then it's time you started to learn.
This is a trivial task to get you thinking about the tools available to you, and how to use them to solve a problem; together with some very simple coding you need to do.
If I write the code then you skip all that - so the next (more complex) task is commensurately harder for you to do, and that process continues until you fail the course.
Read your notes, read the question, and give it a try. This may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hi Everyone,
I added a panel which I will use it as signature drawing pad. I also use itextsharp for creating .pdf function. My question is how can I capture that drawing at panel and print it on .pdf document?
Below is panel code side. I created a button to make .pdf but I don't know how to code that button event.
private void panel1_MouseDown(object sender, MouseEventArgs e)
{
LastX = e.X;
LastY = e.Y;
}
private void panel1_Paint(object sender, PaintEventArgs e)
{
Graphics G = panel1.CreateGraphics();
G.DrawLine(Pens.Black, PointX, PointY, LastX, LastY);
LastX = PointX;
LastY = PointY;
}
private void panel1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
PointX = e.X;
PointY = e.Y;
panel1_Paint(this, null);
|
|
|
|
|
|
Sorry Sandeep, I deleted another post. Thank you.
|
|
|
|
|
Good evening everyone, I have a problem that crushes me. With my app developed in C #, everything works very except that I'm stuck somewhere and I try everything it does not work. Can someone show how to "call a function after the minute's number"? Using timer
|
|
|
|
|
Create a Timer instance, set it's Interval property to 60 * 1000 (it ticks in 1/1000th of a second intervals), and add a handler to the Tick event before you start the timer.
After one minute you will get a Tick event and your handler method will be exectuted.
A minute later the same will happen again.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Can you help me with the code ? Please
|
|
|
|
|
What part of it can't you do on your own?
You know how to create an instance of a Timer, I assume?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
Good. So do that.
And you know how to set a property of an instance, yes?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
Excellent!
And you know how to add an event handler, I'm sure?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
Open Visual Studio.
Immediately after you set the Interval property, type the name of your Timer instance, followed by ".Tick":
myTimer.Interval = 60 * 1000;
myTimer.Tick Press the Tab key. Intellisense will fill in the rest of the line, and create a Tick event handler for you, containing just a "not implemented" exception for you to replace with your code.
You've done that before, haven't you? It's pretty basic stuff!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|