|
Thank you very much for the replies.
I created 10 threads and broke down my file into 10 files. Each thread would loop through then.
This is what I went with in the end:
private void btnRun_Click(object sender, EventArgs e)
{
for (int i = 0; i < threadCount; i++)
{
CreateThread(i);
}
}
private void CreateThread(int threadID)
{
Thread thread = new Thread(new ParameterizedThreadStart(RunProcess));
thread.Start(threadID);
lstThread.Add(thread);
}
private void RunProcess(object threadID)
{
int id = (int)threadID;
for (int i = id; i < threadCount; i += threadCount)
{
ProcessByThread(Convert.ToInt32(threadID));
}
lstThread[id].Abort();
}
private void ProcessByThread(int threadNumber)
{
GetDataFromCsv("Batch" + threadNumber + ".csv", threadNumber);
}
|
|
|
|
|
what is wpf and where should i start?
|
|
|
|
|
Here[^]
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
It's the Windows Presentation Foundation, and is the replacement for Windows Forms. It provides a much richer experience than Win Forms as it's not tied to GDI+, so it's possible to create animations, 3d work, etc... with a lot less work than you used to have to do.
If you want to look into this, there are several good books on WPF - the two standard ones are WPF Unleashed[^] by Adam Nathan and Pro WPF[^] by Matt Macdonald.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
hi everyone i have wrote two application by socket programing that connect to each other by ip the problem is that if listener program has an invalid ip(being in a local network) the other application can not access it i mean that i dont know how to connect to an application that is in a local network
please help me
|
|
|
|
|
Message Closed
modified 23-Nov-14 6:49am.
|
|
|
|
|
hi thank u for your answer and i really appriciate that here is my codes:
|
|
|
|
|
i have a dll that contains WPF controls
i want to add them into a windows form project
how could i do that ?
i added the source to the solution
i didn't see the controls in the toolbox..what's next ?
|
|
|
|
|
That's because a WPF control can't be used in standard Windows form.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
In order to host WPF in Win Forms, you need to add an ElementHost to your form, e.g.
ElementHost host = new ElementHost();
host.Dock = DockStyle.Fill;
host.Child = myWpfControl; Obviously, you'd have to have instantiated myWpfControl before you add it to the host, but this is the general flow.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
i want to learn network programming in c#
can any body send be absolute beginning to network programming link
|
|
|
|
|
You might want to start with WCF.
Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
i suggest you to start with socket programing
|
|
|
|
|
Try this book[^] it is supposedly aimed at beginners.
|
|
|
|
|
How do they work?
I'm having a hard time understanding them.
I've read up on several examples but the code approach just seems strange to me (I'm not a C/C++ programmer so I am not used to function pointers).
Can delegates be compared to Java's addActionListener(new MyHandler());?
If they can, then it would help me understand this far better.
Basically, in Java you add an event handler (java.awt.event.*) to an object (e.g. a button)
and then you tell it that when an action happens on that button (such as being clicked),
said method will be assigned to handle it (MyHandler).
Implemented, it looks like this:
myButton.addActionListener(new MyHandler());
class MyHandler implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
doStuff();
}
}
To my analogy, this would compare to C# like this:
myButton.Click += new System.EventHandler(MyHandler);
public void MyHandler(Object o, EventArgs e)
{
doStuff();
}
So as far as I understood, a delegate delegates the task of doing something, to
a method that has the same signature as the delegate.
What about System.EventHandler(MyMethod) then?
Is one passing a method to EventHandler() as an argument
or is MyMethod replacing EventHandler by its signature?
Do I have to take callback functions in account to understand delegates?
I'm still confused, but I will read up on it (even though I've read a lot about delegates).
Thanks for reading.
Treval
|
|
|
|
|
Delegates are Function type declaration.
Say you have declared
public delegate void mydelegate(int x);
Now mydelegate is a type which can point to a method of same signature as declared.
means u can declare
mydelegate obj= delegate(int x){
};
So now the obj holds a method. So if you call obj(10) it will run your logic.
Now why is it required?
It is required to pass a method directly to a function and execute a custom code block. Say you have built a class which you want others may use. Now you want to implement a callback facility, so that anybody who uses it, you want to invoke a custom method passed in to the constructor on a particular event. So you create a delegate. The caller passes its code just like the example, and the class calls the same during the event. This is how events work in .NET.
I have wrote a couple of lines about delegate here :
Basics of LINQ & Lamda Expressions[^]
You can read it.
|
|
|
|
|
|
They don't; they just sit there.
|
|
|
|
|
Hi.
I'm saving data in one of table with OLEDBCOMMAND.And i have a DataGridView
bound to this table with "BindingSource".
When i use BindingSource.ResetBindings(false); it dosen't show the new records that i saved.
When i close my form and show it againg it show new records.
private void buttonX2_Click(object sender, EventArgs e)
{
if (IsEmpty.Empty(this))
{
if (saveEdit == SaveEdit.Save)
{
dataBase.Save(dataBase.SetDictionary(this), "Anbar_Kala");
anbarKalaBindingSource.ResetBindings(true);
}
}
}
And also when i use Insert property with TableAdapter is dosen't work too.
private void buttonX2_Click(object sender, EventArgs e)
{
anbar_KalaTableAdapter.Insert(TName.Text, TBDate.Text, TFrom.Text, Convert.ToInt32(Tcount.Text), TVahed.Text);
anbarKalaBindingSource.ResetBindings(true);
}
Can you tell what to do?
Thank you.
CanI
|
|
|
|
|
I need to know if a part from my Form is hiding behind another window...
I`m searching from a while... and i got no options...
|
|
|
|
|
I'm sorry, but your question as stated makes no sense.
Do you mean that some control on your form cannot be seen - because it is behind some other control on your form? Or something else?
Is this at design time, or run time?
Is the control added at design time, or when the application is running?
All those who believe in psycho kinesis, raise my hand.
My 's gonna unleash hell on your ass. tastic!
|
|
|
|
|
Hi,
this may or may not help you out:
- get the screen coordinates "RECT" of the Form
- perform Graphics.CopyFromScreen for that RECT to get bitmap1
- hide your Form
- perform Graphics.CopyFromScreen for that RECT to get bitmap2
- show your Form
- now calculate difference of bitmap1 and bitmap2 by comparing all pixels; if you find major regions that didn't change, those were/are covered by something else.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
Is it possible to add, edit, view and delete records using a file only (instead of a database) and .Net 2005 (VB.Net/C#)?
The concept is that a file that'll work more-or-less like a database. One can add, edit, view, delete and query data to and from the file. The file, either cannot be opened directly or data inside the file should be in some encrypted form so that even if the file is opened no one can comprehend it. Data inside the file can only be manipulated by a front end application i.e. .Net 2005.
If there's some methodology like this then please refer me some links to tutorials and whitepapers.
Thanks in advance.
|
|
|
|
|
Yes it is possible, but the question is why would you want to? A database is specifically designed and optimized for such interactions. A file is not. You have to deal with read/write synchronization and locks, IO performance, multi-threading, etc.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I know the database stuff but there are certain small scale projects for which setting a database is a headache and more than it's required. I've seen certain projects where they have used such methodology instead of the database and it's working well, fulfilling most of the database features. Moreover in certain scenarios using a database is more costly. If all my requirements can be fulfilled with file handling method avoiding the database, in that way the system cost can be cut a lot. So I would request you to kindly refer me certain tutorials as I'm badly in need of it. Thanks.
|
|
|
|