|
Your answer is in there, I threw in the code you will need to make it work, infact I gave you multiple options based off the multiple assumptions I had to make. Most importantly, you forgot open.show() to show the form!!
|
|
|
|
|
thanks again EliotA for your answer
the point is i forgot to tell that the main form is already open so if i made a open.show(); i will have 2 forms open and its not what i whant. I already try a open.refresh(); to see if the text change and nothing appen, i also try a open.update(); and no result.
i think will follow your first advise, i think i will get a "c# for dummies" and learn the base to get the things a still dont get.
thanks alot again !
|
|
|
|
|
I have created an application to draw rectangle by using graphics..i got solution to resize,increase,decrease the rectangle..now i want rotate that rectangle...with mouse move events..(float angle should be dynamically)..
..i tried matrix rotation..but am not getting that how float angle will be generated dynamically by moving mouse...
plzzzzzzz Help me...
|
|
|
|
|
As was said the last time you asked this question...
Dragonfly_lee wrote: 1.listen the mouse click and move events.
2.Check the method - RotateTransform of Graphic object. E.g.
gfx.RotateTransform(rotationAngle);
Source[^]
|
|
|
|
|
ya i have seen that message..but rotation angle will be dynamically i want to mention..how should i calculate that rotation angle..when mouse moves on form..
|
|
|
|
|
well clearly he is saying that from the mouse click you can get the point where it was clicked ... then you can track the movement from that point to figure out a direction and hence the angle no?
i think...
"mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"
|
|
|
|
|
try storing the initial mouse click position then use that point, along with the center point of the object and the current mouse pos and use pythagaros (not sure on spelling) thery to calculate angle base on three point, oh you will also have to calculate the distance from points
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
I'm starting a new project which will run a WinForms user interface.
I want the interface to be modular and make good use of code refactoring but it seems this is near impossible with Winforms C#.
At first I evaluated Smart Clients and found that it is exactly what we need, but given our time and resource constraint, it was not a viable solution.
Is there a best practice to create a windows application with seperate panels? Preferably, these panels should be able to contain any specified user control or form.
Every solution I ended up with so far came down to massive code duplication.
|
|
|
|
|
evilnoodle wrote: I want the interface to be modular and make good use of code refactoring but it seems this is near impossible with Winforms C#.
How so?
Have you looked at the CAB stuff in the Enterprise Library? Not that'd I recommend that...
Regards,
Rob Philpott.
|
|
|
|
|
Hi all,
I have a form with a datagridview, a button named "View" and a button named "Update". When i click the button View, datagridview will show all data from database named B sucessfully. Then i can modify or delete or enter new data into datagridview.
I wonder how to update database from datagridview when the button Update is clicked. I try some code but it did not work:
...
myDataSet.Merge(DataSetChanged);
adapt.Update(myDataSet);
// inform the user
label1.Text = adapt.UpdateCommand.CommandText;
Application.DoEvents();
myDataSet.AcceptChanges();
dataGridView1.DataSource = myDataSet.Tables[0].DefaultView;
Regard,
|
|
|
|
|
Do Events, really?
I believe you need to set the data adapter's update, insert, and delete commands for it to work automagically.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
If you don't ask questions the answers won't stand in your way.
Most of this sig is for Google, not ego.
|
|
|
|
|
I don't know how to put insert, delete, update code as you said. I'm just a beginner. Please tell me more if it's possible. Thanks for your help!
|
|
|
|
|
Oh, i find out how to do that. thanks for your help!
|
|
|
|
|
is there any special way of retrieving data from a huge database , because i've developed an app that reads from database and returns a dataset.then in the app using the dataset i fill a listview with each record in dataset. when the records increasing in the DB the time taken to fill the list view also increasing,(i'm using a simple select * query) so i want to reduce this time .
yasith
|
|
|
|
|
Break it up into chunks using LIMIT keyword, that way your application has less to retrieve per each view. You can put a simple button to go to next page etc.
|
|
|
|
|
Don't use a dataset. They are crippling memory hogs. For large amounts of data you need to use a data reader. If the data is sufficiently large you need to break the return up into chucks.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
If you don't ask questions the answers won't stand in your way.
Most of this sig is for Google, not ego.
|
|
|
|
|
Hear hear!
DataSet is evil!
|
|
|
|
|
Hi,
some controls don't need all the data all the time, they can run in virtual mode, needing only the data that is actually visible at any point in time. They fire an event when they need more data to show it. DataGrid is one of those controls.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hello everyone,
Here is my sample program for web service server side and client side. I met with a strnage performance problem, which is, even if I increase the number of threads to call web services, the performance is not improved. At the same time, the CPU/memory/network consumption from performance panel of task manager is low. I am wondering what is the bottleneck and how to improve it?
(My test experience, double the number of threads will almost double the total response time)
Client side:
class Program
{
static Service1[] clients = null;
static Thread[] threads = null;
static void ThreadJob (object index)
{
for (int i = 0; i < 100; i++)
{
clients[(int)index].HelloWorld();
}
}
static void Main(string[] args)
{
Console.WriteLine("Specify number of threads: ");
int number = Int32.Parse(Console.ReadLine());
clients = new Service1[number];
threads = new Thread[number];
for (int i = 0; i < number; i++)
{
clients [i] = new Service1();
ParameterizedThreadStart starter = new ParameterizedThreadStart(ThreadJob);
threads[i] = new Thread(starter);
}
DateTime begin = DateTime.Now;
for (int i = 0; i < number; i++)
{
threads[i].Start(i);
}
for (int i = 0; i < number; i++)
{
threads[i].Join();
}
Console.WriteLine("Total elapsed time (s): " + (DateTime.Now - begin).TotalSeconds);
return;
}
}
Server side:
[WebMethod]
public double HelloWorld()
{
return new Random().NextDouble();
}
thanks in advance,
George
|
|
|
|
|
Threads do not run concurrently (which means at the same time) unless you have hyperthreading technology (which I'm not even sure about that). So the more threads you have, the more checks it has to do, starting and stopping. I am not that great with threading, you'll probably get a much more detailed better response from someone else around here, but that's my understanding of it.
|
|
|
|
|
Thanks EliottA,
I have tried to use thread pool to reduce thread context switch time, here is my code. But the performance never improves, and both the server side and client side CPU/Memory/Network are only used a little from performance tab of task manager. So, I think there are much rooms to optimize?
I am using Windows Server 2003 x64 on both client side and server side.
Any ideas about how to improve performance?
class Program
{
static Service1[] clients = null;
static Thread[] threads = null;
static ManualResetEvent[] doneEvents = null;
static void ThreadJob (object index)
{
for (int i = 0; i < 100; i++)
{
clients[(int)index].HelloWorld();
}
doneEvents[(int)index].Set();
}
static void Main(string[] args)
{
Console.WriteLine("Specify number of threads: ");
int number = Int32.Parse(Console.ReadLine());
clients = new Service1[number];
threads = new Thread[number];
doneEvents = new ManualResetEvent[number];
for (int i = 0; i < number; i++)
{
doneEvents[i] = new ManualResetEvent(false);
clients [i] = new Service1();
clients[i].EnableDecompression = true;
ThreadPool.QueueUserWorkItem(ThreadJob, i);
}
DateTime begin = DateTime.Now;
WaitHandle.WaitAll(doneEvents);
Console.WriteLine("Total elapsed time (s): " + (DateTime.Now - begin).TotalSeconds);
Console.ReadLine();
return;
}
}
regards,
George
|
|
|
|
|
as i know thread.join means calling thread waits in indefinitely till the other thread terminated.so it might be the bottle neck. the other thing is usually we use threads for concurrent processing so if we don't ask the threads to wait till other thread comes they will work independently
yasith
|
|
|
|
|
Thanks yasith,
"so if we don't ask the threads to wait till other thread comes they will work independently" -- I am interested, could you show me your code please?
regards,
George
|
|
|
|
|
Add another NIC. Only one request can go through one network card at a time.
Also, in looking at your code you are locking up each thread with your call to hello world. If you had a stack of methods to call say:
Stack<Service1> clients ...;
You can then use thread safe code inside of your ThreadJob method to pop a service, call its method and then return. Because each thread is now no longer depended on a given service a slow running server will not tie up the entire operation.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
If you don't ask questions the answers won't stand in your way.
Most of this sig is for Google, not ego.
|
|
|
|
|
Thanks Ennis,
Looks like you are an expert of this topic. Cool!
I read your reply 3 times but still confused.
"You can then use thread safe code inside of your ThreadJob method to pop a service, call its method and then return. " -- it is appreciated if you could show me your code please? Honestly, I never wrote such code before.
regards,
George
|
|
|
|