Click here to Skip to main content
15,887,837 members
Home / Discussions / C#
   

C#

 
QuestionHow to insert objects to a section in crystal report dynamically? Pin
getnanda@gmail.com20-Aug-07 18:10
getnanda@gmail.com20-Aug-07 18:10 
AnswerRe: How to insert objects to a section in crystal report dynamically? Pin
help as an alias20-Aug-07 18:23
help as an alias20-Aug-07 18:23 
GeneralRe: How to insert objects to a section in crystal report dynamically? Pin
getnanda@gmail.com20-Aug-07 18:27
getnanda@gmail.com20-Aug-07 18:27 
GeneralRe: How to insert objects to a section in crystal report dynamically? Pin
help as an alias21-Aug-07 1:17
help as an alias21-Aug-07 1:17 
Questiondeclaring xmlserializer where typeof is a class derived from arraylist Pin
cyn820-Aug-07 18:04
cyn820-Aug-07 18:04 
AnswerRe: declaring xmlserializer where typeof is a class derived from arraylist Pin
Hessam Jalali20-Aug-07 23:03
Hessam Jalali20-Aug-07 23:03 
AnswerRe: declaring xmlserializer where typeof is a class derived from arraylist Pin
Hessam Jalali20-Aug-07 23:11
Hessam Jalali20-Aug-07 23:11 
GeneralRe: declaring xmlserializer where typeof is a class derived from arraylist [modified] Pin
cyn821-Aug-07 17:01
cyn821-Aug-07 17:01 
hi, i'm sorry to say that i'm still stuck. The XML file can be generated but it is the same as shown before where there is no root and all the element is "ArrayOfAnyType"
<br />
	[XmlRoot("MyData")]<br />
	public class MyData<br />
	{<br />
		ArrayList shapeTypeList;<br />
		ArrayList colorList;<br />
		ArrayList coordList;<br />
		ArrayList sizeList;<br />
		ArrayList arrS;<br />
<br />
		[XmlArray("ShapeData")]<br />
		[XmlArrayItem("Shape",typeof(ShapeL))]<br />
		public ArrayList ShapeTypeList<br />
		{<br />
			get { return this.shapeTypeList; }<br />
			set{this.shapeTypeList=value;}<br />
		}<br />
<br />
		public class ShapeL<br />
		{<br />
			public ShapeL(){}<br />
			public TypeOfShape c<br />
			{<br />
				get{return c;}<br />
				set{c=value;}<br />
<br />
			}<br />
<br />
		}<br />
<br />
		[XmlArray("ColorData")]<br />
		[XmlArrayItem("Color",typeof(ColorL))]<br />
		public ArrayList ColorList<br />
		{<br />
			get { return this.colorList; }<br />
			set{this.colorList=value;}<br />
		}<br />
<br />
		public class ColorL<br />
		{<br />
			public ColorL(){}<br />
			[XmlElement("color")]<br />
			public Color c<br />
			{<br />
				get{return c;}<br />
				set{c=value;}<br />
<br />
			}<br />
<br />
		}<br />
<br />
		[XmlArray("CoordinateData")]<br />
		[XmlArrayItem("Coordinate",typeof(Coordinate))]<br />
		public ArrayList CoordList<br />
		{<br />
			get { return this.coordList; }<br />
			set{this.coordList=value;}<br />
		}<br />
		<br />
		public class Coordinate<br />
		{<br />
			public Coordinate(){}<br />
			public Point[] point<br />
			{<br />
				get{return point;}<br />
				set{point=value;}<br />
<br />
			}<br />
<br />
		}<br />
	<br />
<br />
		[XmlArray("SizeData")]<br />
		[XmlArrayItem("Size",typeof(SizeL))]<br />
		public ArrayList SizeList<br />
		{<br />
			get { return this.sizeList; }<br />
			set{this.sizeList=value;}<br />
		}<br />
<br />
		public class SizeL<br />
		{<br />
			public SizeL(){}<br />
			public Size c<br />
			{<br />
				get{return c;}<br />
				set{c=value;}<br />
<br />
			}<br />
<br />
		}<br />
<br />
		[XmlArray("GPDData")]<br />
		[XmlArrayItem("GPD",typeof(ArrSave))]<br />
		public ArrayList ArrS<br />
		{<br />
			get { return this.arrS; }<br />
			set{ this.arrS=value;}<br />
		}<br />
		public class ArrSave<br />
		{<br />
			public ArrSave(){}<br />
			public MemoryStream c<br />
			{<br />
				get{return c;}<br />
				set{c=value;}<br />
		<br />
			}<br />
		}<br />
<br />
		<br />
		<br />
<br />
		public MyData()<br />
		{<br />
		}<br />
<br />
		public MyData(ArrayList shape, ArrayList color, ArrayList coord, ArrayList size, ArrayList gpd)<br />
		{<br />
			this.ShapeTypeList = shape;<br />
			this.ColorList = color;<br />
			this.CoordList = coord;<br />
			this.SizeList = size;<br />
			this.ArrS = gpd;<br />
		}<br />
<br />
<br />
<br />
		public enum TypeOfShape<br />
		{<br />
			Square, Rect, Parallelogram, Trapezoid, Diamond, Triangle, RightAngleTriangle,Circle,Oval,Hexagon,Pentagon,None<br />
		}<br />
//		XmlSerializer serializ()<br />
//		{<br />
//			XmlSerializer s = new XmlSerializer( typeof(ArrayList),new Type[] {typeof(Coordinate),typeof(ColorL),typeof(SizeL), typeof(ArrSave)} );<br />
//			return s;<br />
//		}<br />
<br />
		<br />
		public void save( string filename)<br />
		{<br />
		XmlSerializer ser = new XmlSerializer(typeof(ArrayList),new Type[] {typeof(Coordinate),typeof(ColorL),typeof(ShapeL),typeof(SizeL),typeof(ArrSave)} );<br />
	// if i put XmlSerializer ser = new XmlSerializer(typeof(MyData)); it will just generate exception error<br />
<br />
			ArrayList arr=new ArrayList();<br />
			TextWriter w = new StreamWriter( filename );<br />
			ser.Serialize( w, this.ShapeTypeList );<br />
			ser.Serialize( w, this.ColorList );<br />
			ser.Serialize( w,this.CoordList );<br />
			ser.Serialize( w, this.SizeList );<br />
<br />
			for(int i=0;i<this.ArrS.Count;i++)<br />
			{<br />
				GraphicsPathData gpd = new GraphicsPathData((GraphicsPath)this.ArrS[i]);//PathList<br />
				Stream gpdStream = GraphicsPathData.Serialize(gpd);<br />
				arr.Add(gpdStream);<br />
					 <br />
			}<br />
			ser.Serialize( w, arr);<br />
<br />
			w.Close();<br />
		}




Then in save function located at the form, i write:
<br />
MyData d=new MyData(ShapeTypeList,ColorList,CoordList,SizeList,PathList);<br />
						d.save(filename);


Please help...I'm been cracking my head for hoursFrown | :(


Thanks for your helps...


-- modified at 23:13 Tuesday 21st August, 2007
GeneralRe: declaring xmlserializer where typeof is a class derived from arraylist Pin
Hessam Jalali22-Aug-07 0:22
Hessam Jalali22-Aug-07 0:22 
GeneralRe: declaring xmlserializer where typeof is a class derived from arraylist Pin
cyn822-Aug-07 0:29
cyn822-Aug-07 0:29 
GeneralRe: declaring xmlserializer where typeof is a class derived from arraylist Pin
Hessam Jalali22-Aug-07 3:21
Hessam Jalali22-Aug-07 3:21 
GeneralRe: declaring xmlserializer where typeof is a class derived from arraylist [modified] Pin
cyn822-Aug-07 21:48
cyn822-Aug-07 21:48 
GeneralRe: declaring xmlserializer where typeof is a class derived from arraylist Pin
Hessam Jalali23-Aug-07 2:15
Hessam Jalali23-Aug-07 2:15 
GeneralRe: declaring xmlserializer where typeof is a class derived from arraylist Pin
cyn823-Aug-07 16:29
cyn823-Aug-07 16:29 
GeneralRe: declaring xmlserializer where typeof is a class derived from arraylist Pin
Hessam Jalali23-Aug-07 23:47
Hessam Jalali23-Aug-07 23:47 
QuestionHow to "ping" command on Mono by C#? Pin
bug_aonz20-Aug-07 17:49
bug_aonz20-Aug-07 17:49 
AnswerRe: How to "ping" command on Mono by C#? Pin
Vasudevan Deepak Kumar20-Aug-07 21:32
Vasudevan Deepak Kumar20-Aug-07 21:32 
GeneralRe: How to "ping" command on Mono by C#? Pin
bug_aonz21-Aug-07 16:44
bug_aonz21-Aug-07 16:44 
QuestionInstalled software List Pin
Jeeva Jose20-Aug-07 17:15
Jeeva Jose20-Aug-07 17:15 
AnswerRe: Installed software List Pin
Scott Dorman20-Aug-07 17:24
professionalScott Dorman20-Aug-07 17:24 
QuestionC# and MATLAB Pin
TriBerryPowerBar20-Aug-07 15:17
TriBerryPowerBar20-Aug-07 15:17 
AnswerRe: C# and MATLAB Pin
Scott Dorman20-Aug-07 17:23
professionalScott Dorman20-Aug-07 17:23 
QuestionUpdater block - downloading updates from a server Pin
steve_rm20-Aug-07 11:33
steve_rm20-Aug-07 11:33 
QuestionIP Control Pin
Demian Panello20-Aug-07 9:29
Demian Panello20-Aug-07 9:29 
AnswerRe: IP Control Pin
Demian Panello20-Aug-07 10:34
Demian Panello20-Aug-07 10:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.