|
In a form, I add some menus whose short cut are Ctrl-C Ctrl-V and Del for copy/paste/delete action.But the shourt cut make the copy/paste/delete functions achieved by system and acused by keys press(Ctrl-C Ctrl-V and Del) can't do any more .As the functions of Ctrl-C Ctrl-V and Del have been achieved by system, I don't want to redo it and just only use the system achievement! How can I transfer the message to system and let it to process avoiding to process it by myself?
|
|
|
|
|
Hi everybody
I built a form to send/receive information between 2 IPs.
To do that I had to create another thread, but the problem is that when I'm closing the form the debug mode stay turned on in VS, and obviously it is because I created another thread, so the app is not REALLY closed (only the form).
I'm trying to kill the thread in the FormClosing event using thread.Abort() (I placed my new Thread as a private member called thread). most surly I'm missing something pretty basic, can anyone help me with this???
Thanks!
|
|
|
|
|
did you think of creating a "switch" variable?
you could add a private variable to your class called AbortThread (its boolean) and set it to false initially. When closing the form, you set it to true, then you do
while (mythread.ThreadState == ThreadState.Running)
{
Threading.Thread.Sleep(20);
}
In the Threadfunction you have to modify the loop condition (i assume you have one, otherwise the thread would not keep on running) and add a "&& !AbortThread" to it.
This way it will break the thread loop when closing the form.
If you can reduce the code to a minimum paste it here or put it somewhere online if you can't solve the problem with this hint.
good luck,
mik
|
|
|
|
|
thanks!
works great!
|
|
|
|
|
|
Thanks!
|
|
|
|
|
I have a setup project. I want to add a dialog with some checkbox (A, B). When user selects A one dialog should be run at Next button click, when B - the other one. I asked google several times how to do it, but never succeded. Help me, please.
Holodok
|
|
|
|
|
Please Clear ur problem
sikandar
|
|
|
|
|
Pretty hard to answer without knowing how you're building your setup.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hi,
i have a datagrid displaying a access database, i've made a button to add a row, but i dont know how i can delete one.
i dont think it that different
thx
-- modified at 5:38 Friday 15th September, 2006
|
|
|
|
|
call Delete() on the row that you want to delete.
|
|
|
|
|
thx,
im still with left with a problem,
maybe you could help me on that one to
see my orther question above
grz
|
|
|
|
|
Hello again, I really need your help in getting the code for the following ques.:
1. When a user selects multiple rows in the DataGrid, how can I get them programatically? In case of a single selection, i can use something like: datagrid.CurrentSelection.
2. What's the code used to prevent the user from getting the Task Manager window upon pressing Ctrl+Alt+Delete?
Thank you so much, ur help is much appreciated!
Knowledge Is KinG
|
|
|
|
|
engineer_ali wrote: 2. What's the code used to prevent the user from getting the Task Manager window upon pressing Ctrl+Alt+Delete?
You don't.
|
|
|
|
|
1 - you can iterate over all the rows and find which ones are selected
2 - you may be able to do this with a keyboard hook, but why would you do such a user hostile thing ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian Graus wrote: user hostile
Now, there is a great expression I'll have to remember.
|
|
|
|
|
Hi,
My program writes this xml file:
<?xml version="1.0" encoding="utf-8"?>
<Root>
<CarInformation />
<DateOfBuilding>9/15/2006</DateOfBuilding>
<TimeOfBuilding>9:48:51 AM</TimeOfBuilding>
<CarInformation />
</Root>
The "CarInformation" node is the problem.
It starts and ends with '/>'.
This is how it should be:
<Root>
<CarInformation>
<DateOfBuilding>9/15/2006</DateOfBuilding>
<TimeOfBuilding>9:48:51 AM</TimeOfBuilding>
</CarInformation>
</Root>
This is my code:
class XMLWriter
{
XmlDocument xmlDocument = null;
string path = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
XmlElement element = null;
XmlNode node = null;
XmlText text = null;
public XMLWriter()
{
this.xmlDocument = new XmlDocument();
this.xmlDocument.Load(path + "/file.xml");
}
public void WriteStartNodeAfterRoot(string startNode)
{
this.node = this.xmlDocument.CreateElement(startNode);
this.xmlDocument.DocumentElement.AppendChild(this.node);
this.xmlDocument.Save(path + "/file.xml");
}
public void WriteToXMLDoc(string elementString, string attribute)
{
this.element = this.xmlDocument.CreateElement(elementString);
this.text = this.xmlDocument.CreateTextNode(attribute);
this.xmlDocument.DocumentElement.AppendChild(this.element);
this.element.AppendChild(this.text);
this.xmlDocument.Save(path + "/file.xml");
}
public void WriteEndNodeBeforeRoot(string endNode)
{
this.node = this.xmlDocument.CreateElement(endNode);
this.xmlDocument.DocumentElement.AppendChild(this.node);
this.xmlDocument.Save(path + "/file.xml");
}
}
What am i doing wrong?
Thanks in advance!
|
|
|
|
|
You have to get away from the concepts you used when working with the XmlTextWriter. You're now working with the DOM and there is no thing such starting an element and then end it somewhat later.
You create an element, append it as child to some other element and if it should have some child nodes itself they have to be appended too. A good example is the WriteToXMLDoc method where you create an element, append it to the documents root element and afterwards append a text node to the element itself.
To get the wanted XML you have to append the elements created inside WriteToXMLDoc to the previously created carinformation element instead of the xmlDocument.DocumentElement. This will require some refactoring of your class but that shouldn't be too hard.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi Stefan,
I refactored my class. I removed the 2 methods wich i don't need according to you.
This is how it looks like now:
class XMLWriter
{
string path = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
XmlDocument xmlDocument = null;
XmlElement element = null;
XmlText text = null;
public XMLWriter()
{
this.xmlDocument = new XmlDocument();
this.xmlDocument.AppendChild(this.xmlDocument.CreateXmlDeclaration("1.0", "UTF-8", null));
this.xmlDocument.Load(path + "/file.xml");
this.xmlDocument["Root"].AppendChild(this.xmlDocument.CreateElement("CarInformation"));
}
public void WriteToXMLDoc(string elementString, string value)
{
this.element = this.xmlDocument.CreateElement(elementString);
this.text = this.xmlDocument.CreateTextNode(value);
this.xmlDocument["Root"]["CarInformation"].AppendChild(this.element);
this.element.AppendChild(this.text);
this.xmlDocument.Save(path + "/file.xml");
}
}
This is how the output of the xml file looks like:
<?xml version="1.0" encoding="utf-8"?>
<Root>
<CarInformation>
<DateOfBuilding>9/15/2006</DateOfBuilding>
<TimeOfBuilding>1:01:13 PM</TimeOfBuilding>
<DateOfBuilding>9/15/2006</DateOfBuilding>
<TimeOfBuilding>1:02:06 PM</TimeOfBuilding>
</CarInformation>
<CarInformation />
</Root>
It adds everything within the first "<CarInformation>".
What am i doing wrong this time?
Thanks in advance!
|
|
|
|
|
this.xmlDocument["Root"]["CarInformation"].AppendChild(this.element); The above line always successes the first found CarInformation node. Replacing it with the following should resolve the problem
this.xmlDocument.DocumentElement.LastChild.AppendChild(this.element);
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi Stefan,
That worked. You roxxx!
Thank you!
|
|
|
|
|
Hi All,
The application on which I am working has the following requirement:
1) Buttons are displayed as rows and columns in a panel
2) Panel AutoScroll property is set to true
3) On Mouse down on panel, user began to select the controls, A rectangle should be drawn based on mouse movement and the buttons with-in the rectangle should be selected
4) If scrollbar appears in the panel and if the user drags the mouse for selecting the controls, the scrolling should occur based on mouse movement
Your help in this will be needful.
Regards,
David
|
|
|
|
|
Best regards to all C# coders...
Plz I need your help in getting the right code snippet on how i can instantiate, set parameters and finalize a crystal report at runtime, in which the user has to define the parameters or what he wanna see in the report!
By the way, i guess i know how to set parameters and stuff, but i only need to know how to set and instantiate a crystal report programmaticaly.
Your help is much appreciated!
Knowledge Is KinG
|
|
|
|
|
Hi all,
I have a window service and I want to call it's methods by web service.But during calling it's method the service shows an error " The underlying connection was closed: Unable to connect to the remote server ".
I have created a setup of this window service which is I am calling through ServiceController in a web service.
I have checked all connections which are working properly.Please help me to solve this problem .If you can give an idea about how to call window service methods by web service then that will be appriceable.
Thanks in advance
Regards & Thanks
Sunil
|
|
|
|
|
Hi
how can i assign a list dynamically to the toolbar having style = "DropDownButton"
sAqIb
|
|
|
|