|
I have a simple common library project (XXX) with only an interface
with a string property A
public interface IXXX
{
string A{get;}
}
Than the Application A (for example a WinApp project called A)
references to XXX and implement IXXX, using [Serializable] Attribute
[Serializable]
public class XXX : IXXX
{
...
}
It has also a AObj "remotable" class:
public class AObj : MarshalByRefObject
{
IXXX[] GetXXX()
{
...
}
}
Another Application B needs to communicate with application A using Remoting;
B references XXX.dll because in its business logic, some class instance in B
makes a request to an instance of AObj (AObj.GetXXX()) using remoting and
receives from it an Array of IXXX; this call cause a SerializationException;
1)If the implementation XXX is inserted in the XXX project, no error occurs...
2)If I want to implement IXXX in the project A without problem, XXX
must extends MarshalByRefObject, but it's not what I want...
Some ideas?
|
|
|
|
|
Hi,
Im trying to print out a DataGridView. I bascily go through the data grid views columns and draw the columns name as a string. I then go through the data set and draw each row as a string.
The problem im having is i draw the columns/row posistion of the data grid views column width. Thus, if the column is only 10px wide but the text within that row is larger than the column, i draw the row and it over laps the next columns row.
eg:
Column A - ColumnB
aaaaaaaaaaabaaaaa
As you can see, column a's data is draw over column b's. I've thought of trimming the string and only drawing that, but since im printing the data, that kinda defeats the whole idea of printing something out.
Does anyone have any ideas how to over come this?
My only idea how to fix it would be to go through columns and check the width is big anough for the rows, and if not adjust the posistion and then draw the column names.
Regards,
Gareth.
|
|
|
|
|
|
kubben: Sorry, your article was of no help, thank you anyways.
Regards,
Gareth.
|
|
|
|
|
Hi,
This is abit of a hack, but i found out if you did the below:
foreach (DataGridViewColumn col in dataGridView.Columns)<br />
{<br />
col.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;<br />
}
It would expand the columns to display all the data within the cells.
Thus, problem solved.
Regards,
Gareth.
|
|
|
|
|
I have the following to serialize a simple string[] array:
<br />
string[] peteArray = new string[3] { "pete", "loves", "bananas" };<br />
string<br />
<br />
xmlPath = Application.StartupPath.ToString() + "\\" + "petesDiet.xml"; <br />
<br />
FileStream nameStream = new FileStream (xmlPath , FileMode.OpenOrCreate, FileAccess.ReadWrite); <br />
<br />
XmlSerializer nameSerializer = new XmlSerializer (peteArray.GetType()); <br />
nameSerializer.Serialize(nameStream, peteArray);<br />
<br />
nameStream.Close();<br />
<br />
It works fine. The problem comes in to try and de-serialize this - the Deserialize method doesn't seem to want to get a string[] object.
I have also tried the List<string> and using the CustomXMLSerializer (a class written by a guy on here) which seemed like it would have the solution but it doesn't work either!
Any help would be much appreciated!
Gerry
xml newbie
|
|
|
|
|
Do you get an exception when trying to deserialize?
|
|
|
|
|
No I can't even get to the running stage, I get a compiler error:
Error 1 Invalid expression term 'string' C:\D\CSharp\SysTrader\SysTrader\SysTrader\SysTraderForm.cs 688 71 SysTrader
The problem is when I try to initialize/create the Deserializer (in a different part of the program, or when the program has been restarted):
<br />
XmlSerializer xmlDeserializer = new XmlSerializer( string );<br />
XmlSerializer( Type type) takes type as an argument, and string[] produces an error too...
Thanks for your help!
Gerry
|
|
|
|
|
It should be like this:
XmlSerializer xmlDeserializer = new XmlSerializer( typeof(string) );
|
|
|
|
|
You could try:
XmlSerializer xmlDeserializer = new XmlSerializer(typeof(string[]));
Regards,
Gareth.
|
|
|
|
|
Well, yes. So it works now, right?
|
|
|
|
|
Hi Gerry,
While serializing and deserializing an array, list etc, I always find it better to create a wrapper class. That makes the things clearer and error free.
Like for your case create a class as below:
[Serializable]
class PeteArray
{
protected string[] arrPete;
//Function to set and get the values
}
Finally you can use this class Serialize and Deserialize.
Manoj
Never Give up
|
|
|
|
|
Thanks alot guys,
that helps alot, pretty sure got it cracked!
Thanks again,
Gerry
|
|
|
|
|
I want to have some free ebooks about C# 2005.
can you help me ?
Thank you verry much !
by Giang Nguyen
|
|
|
|
|
http://esnips.com
http://itebookhome.com
now --> http://www.itstudy8.org/
First and the Foremost: FIGHT TO WIN
About Me
|
|
|
|
|
|
|
How should i can create a webpart for sharepoint server 2007 site so it can create the RSS feed for the data displayed the site page.
From Juber
|
|
|
|
|
I have been thinking and figuring to put the value close to the curve or the edge of the pie chart.
I know how the chart it drawing but it really to figure out how the position of X,Y moving.
Anybody can help me with this problem?
Thank you very much for all your help.
Ps. my english so poor and hope you guy understand what I mean.
junior boy
|
|
|
|
|
If you're drawing it yourself, you already know where the edge is. If you're not, what do you know ? The centre point and radius ? You can work it out from there easy enough.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Thank you for your suggestion,Christian Graus.
I coding it by my own and I know exactly where the center is but the problem is I can not put the value that go around the pie such as in MS.Exel.
If you have any idea to suggest to me that will be very kind of you.
Thank you for all replied.
junior boy
|
|
|
|
|
Well, with a bunch of sin and cos and a bit of multiplication, you can do it.
Can you be more precise in your questions?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
I am coding a program that drawing shapes in canvas. Shapes can move, rotate, resize and group together. I tried many ways (using Matrix...) but it still slow and not accuracy (due to rotate action).
Anybody knows any program do like me or any document about this problems, help me!!!!
Thank for your help!
|
|
|
|
|
If they are moving, you should be using DirectX
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
It is like you edit a canvas in Microsoft Word, I dont think I have to use DirectX
|
|
|
|