|
|
hi,
If i use Func<double,double> call= y=>fun3(y,z) , fun3 can be one output param function. But if my function need 2 or more output, how can i do it?
|
|
|
|
|
Sorry, I'm not following you.
Do you mean you want multiple return values from your function? If so, you'll need to create a class or structure to contain them:
public struct Fun3ReturnValues
{
public int SomeValue { get; set; }
public string SomeOtherValue { get; set; }
}
...
public static Fun3ReturnValues Fun3(int y, int z)
{
return new Fun3ReturnValues
{
SomeValue = 42,
SomeOtherValue = "Hello",
};
}
Alternatively, you could use the Tuple class[^], but the meaning of the values wouldn't be as clear.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
|
|
Hi,
I want a quick feedback as soon as a particular file is on an FTP server. What is the most effective way to get this information quickly?
File is comming daily from a service-provider.
File is stored in ftp-FileSystem with fix name+[Date]
Software is running on a Server (C# or Powershell)
We need this file asap after incomming to ftp-Server
(can we implement a FTP-Event for watching incomming Sigh | )
Thanks &
Regards
Nicole
modified 27-Nov-15 9:54am.
|
|
|
|
|
Get it from where, where does the file come from, where is it stored, is your software running on the server or on a client, etc?
Please edit your question and add some context and proper detail.
|
|
|
|
|
File is comming daily from a service-provider.
File is stored in ftp-FileSystem with fix name+[Date]
Software is running on a Server (C# or Powershell)
We need this file asap after incomming to ftp-Server
(can we implement a FTP-Event for watching incomming )
|
|
|
|
|
|
Keep in mind no matter what you use to tell you that the "file is there" it is merely telling you that the filename has been created. It will not tell you if the file has something in it or that the file transfer from the uploader has completed.
|
|
|
|
|
Very true.
Only sure way I have found for this is to require that a marker file be laid down after all other transfers have been completed.
|
|
|
|
|
I am new to c#. I have the following in my project in windows forms:
Form1 with button and DataGridView.
Form2 with button.
Form3 with button and 3 textBoxes.
In form1, I click buttonOpenForm2 form2 pops up. Then in form2 I click buttonOpenForm3 form3 pops up which has 3 text boxes and button. Now the 3 forms are open.
now in form3, I enter values in textBox1, textBox2 and textBox3 and when click buttonAddRow ( from form3) I want these values to be inserted into the DataGRidView in Form1.
My question is: How can I add a row into DataGridView in Form1 ( parent) from form3 (child of child form) WITHOUT closing form2 and form3? I mean I want to pass the data while form2 and form3 are still open.
Please help me. Thank you
Form1:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void buttonOpenForm2 _Click(object sender, EventArgs e)
{
Form2 frm2 = new Form2();
frm2.Show();
}
}
Form2:
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void buttonOpenForm3 _Click(object sender, EventArgs e)
{
Form3 frm3 = new Form3();
frm3.Show();
}
}
Form3:
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}
private void buttonAddRow _Click(object sender, EventArgs e)
{
}
}
|
|
|
|
|
|
Hi, thank you for the help, I will have to study the properties and events then i will test the code written in the answer. thank you
|
|
|
|
|
You're welcome!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
What was wrong with the answer you got on November 6th. when you asked the same question: [^] ?
Why use three Forms when you can use one Form and UserControls ?
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|
Hi . nothing wrong but i am new to c# and i have to study the events and property then i will test the code. yes i will try to use form and user control instead, thank you
|
|
|
|
|
Build some business logic, i.e. class(es) for storing the text entered form3 and pass it/them to form1 in buttonAddRow_Click
or make something like this
public struct EnteredText
{
public string t1, t2, t3;
};
public partial class Form3 : Form
{
public delegate void ButtonClick(EnteredText data);
public event ButtonClick OnClick;
...
private void buttonAddRow _Click(object sender, EventArgs e)
{
EnteredText args;
args.t1 = textbox1.Text; args.t2 = ...
if (OnClick != null)
OnClick(args);
}
}
Means you copy the text from the boxes into the struct and fire the event OnClick. Somewhere in Form2 you should do something like this:
Form3 f3 = new Form3();
f3.OnClick += f3_OnClick;
f3.Show();
}
private void f3_OnClick(EnteredText txt)
{
}
|
|
|
|
|
Hi, when i use chart to plot, i have 10 line series and each have 1000 points. i use " chart.series.add("series[i]")" to add series in chart. But when they are all in chart, chart speed is slow and delay, Zoom in and annotation are all delayed.
Can above quesiton be solved?
|
|
|
|
|
Yeah. Don't fill the chart with 10,000 points. Reduce the dataset down to what's important and the redraw will speed up dramatically.
If your graph area is only 300 pixels wide, why are you stuffing in 3 times as many points as it can show?
|
|
|
|
|
Yes,you are right,thank you.
I didnot care of the pixels wide, because i need pricision and smooth curve, so i use 1000 points.
have any other solution to solve it? because if i use 300 points, but maybe i need plot 30 series in chartarea, how to solve it greatly ?
|
|
|
|
|
Ummm, perhaps you didn't hear me... The ONLY way to speed up the drawing of the chart, using any off-the-shelf charting library, is to reduce the number of points.
Now, if you tried to roll-your-own charting library, you could put in some optimizations specific to your requirements to speed things up a bit.
No matter what you do the BIGGEST speed boost is to not draw so many points.
|
|
|
|
|
Thank you all, i will adopt you good idea, to reduce points.
|
|
|
|
|
Oh,i found that if 10000points in 1 series, the chart will not be delay.
So i want to know,how to make series, that 1000 points be in one line, other 1000points be another line.... make 10 series type ,but in 1 series collection?
|
|
|
|