How would programatically change the NotifyIcon icon while a program is running. Like say I had an email checking program that ran down in the system tray but I wanted the icon to change from black to green if I have an email waiting? Or better yet display a number that is the quanitity of unread email messages on the server. Is there a away to do this without having a 99 .ico files somehwhere on the file system that are loaded when needed.
In other words is there a way to dynamically generate an icon file on the fly and then use it as the NotifyIcon?
Does anyone have some good samples of Serializing a parent object that has child objects that in
turn may have child objects. I can serialize the parent but it doesnt like what I am doing with the children unless I make them an array. At least I think it likes the array. I would like to keep the children in an ArrayList or Generic List<child>. I have one example but it uses a Hashtable and I am not sure the sample will translate into what I am doing.
I would like to serialize it to XML so I am using the XmlSerializer. It serializes the parent but chokes on the the children. I have some code but it is not quite what I am doing. Any other help would be appreicated.
Without the actual error message it's hard to say what the problem is. But, here are some things to keep in mind about the XmlSerializer:
1) It does not serialize object graphs with circularites (A references B, and B directly or indirectly references A). It makes exceptions to this rule for a select few classes in the .NET framework, such as the DataSet, but that doesn't help the rest of us.
2) As 'theRealCondor' mentioned, it only serializes public get/set properties of an object. (It also will serialize public fields, but those should never exist!)
3) There are some attributes you can use to control how the serialization of sub-objects is performed (this might be relevant to your issue, somehow).
If you are using XmlSerializer all properties must be public. I'm not sure about how it walks the properties within the child.
If the class is not public or you have private data, then you need to inherit ISerializable as well as IDeSerializableCallBack and handle the serialization manually. There are articles on MSDN that describe how to do this.
I have a crystal report which contains a subreport. That subreport does not
show the result of the formula field when the main report is displayed,
although it does show if the subreport is displayed by itself.
The formula is valid (and I have tried this with much simpler formulae
I am using object collections to populate the report and subreport,
extending the example given in MSDN.
List<DirectConsumerLoan_Helper> ds = new List<DirectConsumerLoan_Helper>();<br />
List<Sub_Parties_Helper> dsBorrowers = new List<Sub_Parties_Helper>();<br />
//plus populating code for both lists using .Add (not included here)<br />
CrystalDecisions.CrystalReports.Engine.ReportDocument subrpt =<br />
// This works if run by itsef:<br />//rpt.Load(".\\Reports\\Sub_Parties.rpt");<br />//rpt.SetDataSource(dsBorrowers);<br />
I'd like to host a custom usercontrol inside of a DataGridViewHeaderCell ... I made an attempt @ extending the DataGridViewHeaderCell, and I tried to add it into a table, but this led me nowhere. Could anyone tell me how I can go about adding a control (which in turn contains buttons and checkboxes) to a DataGridViewHeaderCell. I really can't seem to figure it out ... the samples provided by Microsoft only demonstrate how to add something that inherits from a simple control such as textbox or a calendar (datetimepicker).
I recently found a post on Microsoft's Forums that suggested using custom painting, but that just seems too hairy to get involved with. All I want to do is add 4 buttons (contained in one user control) to a DataGridView HeaderCell. Microsoft said that you can't do this because it won't support hosting a panel inside of the cell. It just seems strange to me that no one else has tried to do this and succeeded ... unless I just haven't found it yet. My second thought is that I could make a control consisting of a DataGridView and several "FakeColumns" that would contain the buttons and upon clicking them would trigger changes to the DataGridView, which would not have HeaderCells. Idea is below ... suggestions/comments welcome and needed desperately. Thanks again.
*** = Panel containing my controls and HeaderText Labels for column names
+---+ = DataGridView (standard MS-built .NET 2.0 control)
| | |
| | |
* Column Name * Column Name2 * Column Name3 *
* * * *
* [user control] * [user control ] * [user control] *
| data | data | data |
| data | data | data |
| data | data | data |
I'm looking for a small C# code sample (client and server) on how to do the following (if at all possible):
1. Have a client connect to a server using WSE2.0 using a TCP socket (not http)
2. Have the connected server send a message to the client without the traditional preliminary client request.
My understanding is that this is completely possible with WSE2.0. To date, we have a client/server app that has to poll the server for more information using standard HTTP webservices, but we are looking to optimize this by simply letting the server tell the client when there is new information and proactively send it.
Can anyone point me to a sample code or whip something up quickly?
I need a help!
I try to make a program that can define the contours and verctorise a geometric shape in a bitmap image.
If someone know any algorithm that do it, or have the solution to my problem please contact me!
StackOverflow exceptions will sometimes shoot right past all your catch blocks and leave your process in an invalid state.
This happens because CLR does not throw the exception until it is truly out of stack, so there is no stack left to handle the exception. This has caused me great discomfort.
Java does not have this defect becuase they had the good sense to throw the exception before the thread is truly out of stack.
This is an intermittent bug that is difficult to duplicate. Here is a self-recursing function that eventually throws a stack overflow. But depending on what other code is in the function, it may or may not be caught in VB.net. I could not duplicate the behavior in C# in a simple sample, but have experienced it first hand in a real C# app:
Hopefully if enough noise/publicity is made, MS will fix this sooner rather than later.
HAHAHA, it was in fact a flaw that it was being caught in some cases in .NET 1.1. In .NET 2 its totally uncatchable. There is something very wrong with your code if u hit a stack overflow. Sometimes however, you might just have a lazy recursive method (like probing a double linked list without tail calls). Those you should be aware of in the 1st place. From my experience the runtime stack allows up to around 16K nested stacks, by default. Add some counters like:
if (count > 15000)
// do something recursivereturn foo;
The tables are designed as: if the customer details has to be added it has to be first added to the Cust_master then get the Cust_Id (which gives autogenerated key) and then add it to Customer details table.
I want to show a editable datagird in WinForms where I give the user an option to add/modify and delete the customer details.
Can any give me the idea of how I can accomplish this.
Hi i'm creating add-in in C# in order to create a list of the Project references for the entire solution. From my understanding, when you import a COM object ( ocx or dll) it creates a wrapper around the COM object and it names the wrapper Interop.<filename>.dll regardless if its a ocx or dll. I am using the DTE and VSproject objects to access the references collection for each project in the solution within my add-in . My problem is, the reference collection is pointing to the wrapper local copies. I wish to display the absolute original path of the reference. Basically instead of getting the wrapper Interop.filename.dll i want it to have the original filename.ocx or filename.dll
I have a text box to get info off the user. It should be an int but i cant be sure so i must validate it first. How do I tell if a string is an int? I know i could do Convert.toInt.... and put it in a try catch but is there another way? Thanks in advance
Look up the overloads too, because it intially expects an int with no formatting whatsoever, but using system.globalization.numberstyle.* you can have it automaticlly handle commas, currency symbols, etc.