|
What are you using to serialize the object graph? The XmlSerializer? The BinaryFormatter? SoapFormatter? The different serialization techniques have different requirements/constraints.
Josh
|
|
|
|
|
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).
Here's a great tutorial on everything you would ever want to know about the XmlSerializer: http://www.topxml.com/xmlserializer/[^]
I hope that helps,
Josh
|
|
|
|
|
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.
|
|
|
|
|
Hello,
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
without success).
I am using object collections to populate the report and subreport,
extending the example given in MSDN.
<br />
List<DirectConsumerLoan_Helper> ds = new List<DirectConsumerLoan_Helper>();<br />
List<Sub_Parties_Helper> dsBorrowers = new List<Sub_Parties_Helper>();<br />
<br />
rpt.Load(".\\Reports\\DirectConsumerLoan.rpt");<br />
rpt.SetDataSource(ds);<br />
<br />
CrystalDecisions.CrystalReports.Engine.ReportDocument subrpt =<br />
rpt.Subreports["Sub_Parties.rpt"];<br />
subrpt.SetDataSource(dsBorrowers);<br />
<br />
<br />
_Main.OpenReportViewer(rpt);
I am using VS2005.
|
|
|
|
|
In desperation I solved this by vertically resizing the formula field!
Remakrably when I shrunk it back to its previous size it still worked. The inner mysteries of Crystal!
|
|
|
|
|
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).
Anyone know of a good way of doing this?
Thanks in advance,
|
|
|
|
|
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 |
+-----------------------------------------------------------+
|
|
|
|
|
Hi,
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?
Thanks!
take care,
Jasen
|
|
|
|
|
|
Hi ppl,
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!
PS: Sorry my writen english, i'm Portuguese
MD - mdfixe@gmail.com
|
|
|
|
|
|
Thks for the answer
I already make that, now that i want is trace vectorize(with lines) the image contours that was defined after applied this filter
Thanks
MD
|
|
|
|
|
You are more likely to get an answer in a Flash forum rather than a C# forum.
|
|
|
|
|
.NET CLR cannot reliably catch stack overflow exceptions.
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:
http://www.standards.com/VBNET/TryCatch.html
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:
try
{
count++;
if (count > 15000)
return null;
return foo;
}
finally
{
count--;
}
|
|
|
|
|
hi,
I have two tables
Table1:Cust_Master CustID (identity type) CustName
Table2: Customer details
CustID
CustName
CustAddress
Cust phone
....
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.
Now:
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.
Thanks
Satishrg
-- modified at 13:31 Wednesday 19th April, 2006
|
|
|
|
|
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
|
|
|
|
|
try int.TryParse()[^]
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.
|
|
|
|
|
|
You could use a regular expression to test the string to see that all characters are numeric.
Somthing like:
private static Regex _isNumber = new Regex(@"^\d+$");
public static bool IsInteger(string theValue)
{
Match m = _isNumber.Match(theValue);
return m.Success;
}
*not tested
Louis
* google is your friend *
-- modified at 16:36 Wednesday 19th April, 2006
|
|
|
|
|
You can also try to capture the KeyPress event on the text box and check the user input.
void TextBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if(!Char.IsDigit(e.KeyChar) && e.KeyChar != (char)8)
{
e.Handled = true;
}
else
{
e.Handled = false;
}
}
(char) 8 is the backspace key...so the user can actually delete the entry as well !
|
|
|
|
|
Are there any good UI design web sites that i can look in to ?
especially concerned with business application UI design ?
Thanks!
|
|
|
|
|
Doing a google for Common User Interfaces came up with this white paper on CUI Standards[^]
|
|
|
|