:confused:I have a problem with the Deserialize a xml string. I have a object I serialize: MemoryStream buffer = new MemoryStream(); System.Xml.Serialization.XmlSerializer xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(myobject)); xmlSerializer.Serialize(buffer, schedule); if I Deserialize the object after this code line, it works fine. But if I store the xml in code it Deserialize it gives me an error. XmlDocument doc = new XmlDocument(); doc.Load(buffer); string xml = doc.OuterXml; XmlTextReader xmlreader = new XmlTextReader(xml); schedule = (ScheduleDefinition) serializer.Deserialize(xmlreader); I need the xml string as a parameter, so i need to be able to convert it back into the object. But I always get the message: {"There is an error in XML document (1, 426)." } Any other suggestions to accomplish this? X|
drey1
Posts
-
help with Deserialize a string problem in c# -
get excel sheets from c#thank you, that would be perfect IF i could use the microsoft.jet.4.0 driver. But, so far I keep getting the message saying the that the porvider is not registered on the local machine. Even thought, it is : I download the:sigh: lastest, i check the registry and i manually register using the regsvr32 sqloledb.dll. but nothing worked. so, i decided to try the odbc and it works, but i do not know how to get the tables with it. I appreciate any suggestions...
-
get excel sheets from c#I would like to know how to get the name of the excel sheets in a excel file using odbc driver? i do not want to open a excel object, since i have to process many files and the only information I need is the sheet name. thank you drey
-
custom control propertygrid bindI am having a hard time finding how to add a collection to a custom property. i have a datasouce property ( datatable ) and i would like another property that allow me to choose the datacolumns i would like to use(from the datasouce above). i have no problem with the datasource property but the datacolumns i do not know how to add. Can any one help? thank you drey
-
Inherit Tree View property problem!that's what i was missing! and the : [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] thank you drey
-
Inherit Tree View property problem!i am creating a databound treeview but i am having trouble with my properties. I created a collection to hold the labels. and i added to the designer. I can create the labes, however, i do not know how can i save it; public class MyTreeColumns // this is my class containing the string label public class MyTreeColumnsCollection:CollectionBase // this is my collection of labels with methods for indexing, Add, Indexof, insert, remove, and contains. in the dataTreeView class I added: MyTreeColumnsCollection _objects = new MyTreeColumnsCollection(); [Browsable(true)] public MyTreeColumnsCollection TreeColumns { get { return _objects; } set { _objects = value; } } what i am missing? thank you drey:confused:
-
Remove buttons from Monthcalendar controlHow can i hide or remove 1 or 2 of the buttons (next/previous month) in the MonthCalendar Control ? Is there a way to do it ?
-
DateTimePicker ProblemI put a question about this control yesterday, but unfortunatelly i could not get a solution. So i change the flow of my program, but I still have one problem. the DateTimePicker.valuechanged event executes twice... I ask the other programmers here and not one knows why this control behives like this. So maybe someone have an answer. (searching the net i found two programmers that created new threads to resolve the problem, but that does not work for me, because I need the return from the "IsValid":confused: ). Code sample: bool b = true; //the code below does not work because the second time around the value still //the original value in memory if(((DateTimePicker)sender).Tag.ToString() == ((DateTimePicker)sender).Value.ToString()) return; this.Cursor = Cursors.WaitCursor; if(isValid(sender)) { tToDate.MinDate = tFromDate.Value; BindTimecard(tFromDate.Value,tToDate.Value); ((DateTimePicker)sender).Tag = ((DateTimePicker)sender).Value; } private bool IsValid(object sender, object r) { if(objdsIO.TimeCard.GetErrors().Length > 0) { string msg = "Please, Delete or Fix Records in Error, before Proceding!"; MessageBoxButtons button = MessageBoxButtons.OK; MessageBoxIcon icon = MessageBoxIcon.Error; MessageBox.Show(this,msg,"Error",button,icon); ((DateTimePicker)sender).ValueChanged -=new EventHandler(TimeDate_ValueChanged); ((DateTimePicker)sender).Value = DateTime.Parse(((DateTimePicker)sender).Tag.ToString()); ((DateTimePicker)sender).ValueChanged +=new EventHandler(TimeDate_ValueChanged); return false; } return true; } thank you for your help!
-
Validating a date in a DateTimePicker...another problem is that the validationEvent is not trigged when I choose a date in the calendar.
-
Validating a date in a DateTimePickerThe problem with the validating event is the messagebox. the messagebox kicks the "valuechanged" event. even if i disable the event before the messagebox, the value already changed and the event is not kicked afterwards when i want to. also there is the path that does not go through the messagebox(when the date is valid). and so on... I keep getting caught on something. it would be simpler if i could get the messagebox to stop changing the value of the datetimepicker before the validating is finished. thank you
-
Validating a date in a DateTimePickerthis is what i need to do: user enters a date in the DateTimePicker. the code needs to validate the date agains a few criterias. if it does not pass the validation. display a message asking if the user really wants that date. if the user wants to continue with the date, just go ahead. if not the date should go back to what it was. I am having the hardest time to get the program to flow thist way. I tried to extend the datetimepicker to add a onchanging event, i tried the validating event. But so far there is always one thing in this flow that does not work. Can any one help! thank you tephra:confused:
-
help with CreateProcessWithLogonWThank you for your reply. My process runs fine. I get and id back and I use the getprocess method to get the process. but when it hit the code Process.EnableRaisingEvents or any Process.(something) it gives me an Access denied message. But if i impersonate myself, it works fine. this is the code: bool ret = true; ret = CreateProcessWithLogonW(m_username, m_domain, m_password, (int)LogonFlags.WithProfile,null,m_sb, (uint)PriorityFlags.NormalPriority | (uint)CreationFlags.UnicodeEnvironment, IntPtr.Zero,"c:\\", ref m_sui, out m_pi); if(ret) { System.Diagnostics.Process p = System.Diagnostics.Process.GetProcessById(m_pi.dwProcessId); p.EnableRaisingEvents = true; "FAILS IN THIS LINE" }
-
help with CreateProcessWithLogonWI am using "CreateProcessWithLogonW" in my code. it works fine it runs the application as intended, up to the point that returns a process in code. My problem is: Since I am impersonating another user, Access to the process is denied. I need to add the "Exited" event to this process, but I keep getting the "Access denied" message. Thank you for any help I can get.
-
windows application html page problem.Just to test, I created a simple html page and inserted a gif image. I was able to view it in a browser. However, at first view, I can not do anything else with it. It seams static. I do not know how I can dynamically add any thing to it. I am not sure that is the right way to go for me. ie. I am trying to create an index html file with links to PDF files, and those files will always change. So the html has to be dynamic. thank you
-
windows application html page problem.I have a windows application in c#. I am required to create an html file and save on a certain directory. At the moment I am writing the file using streamwriter. But I do have a problem with the images in the file in deployment. I notice that I have available when I add an item to the project to add html page. Does anyone know if that can be dynamically altered? or anyone have a better way to add an html page? thank you tephra