|
sonigirish wrote: I can close the forms but the application keeps running in the task manager's processes. Can anyone help me out?
You have to close the main form(where main() function resides). Once you close the main form, it will be removed from process list.
|
|
|
|
|
Thanks for reply I am having two forms when i click button on form1 then form1 will close and form2 will open. I want to close application by clicking on button on form2.
Girish Soni
|
|
|
|
|
sonigirish wrote: i click button on form1 then form1 will close and form2 will open. I want to close application by clicking on button on form2.
In which form your main() method resides ? How you are closing form1 when form2 is open ? Are you just hiding form1 when form2 shows ?
|
|
|
|
|
My main method is in program.cs and my first form is form1 and on button click event code is
private void button1_Click(object sender, EventArgs e)
{
this.Hide();
Form2 frm = new Form2() ;
frm.Show() ;
}
I want to close application on form2' button click ie button2-Click event
Girish Soni
|
|
|
|
|
sonigirish wrote: I want to close application on form2' button click ie button2-Click event
Write a method in your first form which closes that form. Using delegates, call this method when form2 is closed. This will close your entire APP.
Alternatively, you can pass form1 object to form2 constructor, and dispose this object when form2 closed.
|
|
|
|
|
hi
u can use Application.Exit() where evr u plan to terminate the application. for eg. if after showing form1 u want to close it, then on lets say btnExit_click event, u can use Application.Exit() to close the entire application and this would also remove the application thread from the task manager. This method basically terminates the application domain which the application is running in.Hope this would help.
Cheers
|
|
|
|
|
If your app is running with all forms closed, you must have a thread running. What if you debug, close all and hit the break menu item to see where the code is ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Use Application.End() function it will close the application
with regards
yogesh agarwal
|
|
|
|
|
You mean Application.Exit() ?
|
|
|
|
|
hi all and thanks for trying to help ,
currently im working on a project wich involves a multi threaded server
and a client program .
can anyone advice me of a common method which i could retreive with my client program an updated list of users online on my server , which keep updating once user left the server or a new user has joined the server ,
i mean many online games or applications have something like that , i would like to know how to do it , any advice would be great thanks.
Net
|
|
|
|
|
When any user update in a server list then server send an event to client with updated list and then update the client list.
Clien hold the Remote server object and when server object raise an event then client trace that event.
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
thanks for your answer ,
if i have 100's of users on my server...would it be a " wise way " to costantly send an updated list to all of my 100's of users for any small event such as this ?
or is there any more efficient way to this?
-- modified at 1:51 Monday 1st October, 2007
Net
|
|
|
|
|
So you are not able to creat a client listner event for server ?
It's easy way you can creat a client listner and handle in it with parameter.
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
Parwej Ahamad wrote: So you are not able to creat a client listner event for server ?
Parwej,
As per my knowledge, we wont be able to fire events on client/server using TCP communication. Because messages will be passed through streams. So how events are fired ? Or am I missing something ?
|
|
|
|
|
udikantz wrote: can anyone advice me of a common method which i could retreive with my client program an updated list of users online on my server ,
How you are communicating with the client to server ? Are you keeping client socket object on server ? if yes you can create a method on server which returns the total count of this objects. Client has to send message to the server requesting for this number (may be you could define some proprietary protocols). Catch the message on server and call the appropriate method, and sends the message back to client.
|
|
|
|
|
i am communicating with client server over a tcp socket as for now i am using strings to communicate.... , i am keeping client socket object for each client on the server side , i need to send some sort of updated list or dataset to all of my clients which includes information such the username and some other stuff.... , the question is how can i send that kind of list , there must be some efficient technique for that cause almost evry server have this functionality , hope i was more clear.
thanks again!
Net
|
|
|
|
|
udikantz wrote: he question is how can i send that kind of list , there must be some efficient technique for that cause almost evry server have this functionality
I am not sure that you can send a dataset. But you can create a custom serializable class which holds all the information to be send, then send that object through stream.
|
|
|
|
|
Hy,
A nice way to send a list to the client would be to create an XML string with everything you need, something like:
<users>
<user id="...">
<name>...</name>
<surname>...</surname>
</user>
<user id="...">
<name>...</name>
<surname>...</surname>
</user>
</users>
An XML string is very easy to send over TCP/IP, it's small in size...and you can work on that string on the client side using XMLDocument or such.
Hope it helps,
Do your best to be the best
|
|
|
|
|
thats a realy nice idea ,
is there any classes / methods i can use in order to construct the xml strings i wish to send?
Net
|
|
|
|
|
actually I used my own methods to generate the XML string, mainly by manipulating a StringBuilder class
Do your best to be the best
|
|
|
|
|
So on my desk, i have nothing but a computer running Windows XP SP2.
I want to connect a usb connector into my computer, into a component board with an LED.
Then I want to create a program in C# command line that I can turn the light on and off.
I'm told this could more difficult than I'm planning on... But if anyone has ANY ideas on where to start, or tutorials etc, I would be greatly appreciative.
Thanks
|
|
|
|
|
basically this kind of programs in Windows 2000/NT based systems work with a special driver u would need to download the driver first and then may be search for an API that would help you communicate with the USB device.the driver is needed because unlike the Windows9X based systems, XP,2000/NT do not allow direct access to the kernel.
|
|
|
|
|
If you buy a USB-to-RS232C cable, you can connect a LED (with resistor!) to one of the
serial control lines (e.g. RTS); the serial port will show up in the list of available
serial ports, and the SerialPort class will provide access to the control lines.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hello all..
I have been using ASP.Net 2 with c#.My problem is as follows:
I need to put an image.I have used an image control for the purpose .i have well placed the image.But when i view the page on the browser the image doesnt seem to fit into the control but the image takes its original size.How can i auto fit it into the control?Any ideas?
confusedme
|
|
|
|
|
You put the size in the control and it will size it.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|