|
I have class
FormData {
public System.Drawing.Font TextBoxFont;
}
I need to read/store this class in isolated storage in Winforms application and also in user settings.
Using
XmlSerializer formatter = new XmlSerializer(typeof(FormData),
"MyNameSpace");
causes exception
System.Drawing.Font cannot be serialized because it does not have a
parameterless constructor.
How to fix ?
Andrus
|
|
|
|
|
AndrusM wrote: How to fix ?
Well you are going to want to check out how to control Serialization, there are a number of ways. You probably want to start with this[^] You may end up implementing IXmlSerializable[^]
It shouldn't take you long to get up to speed, I have used it in the past and it's fairly simple.
led mike
|
|
|
|
|
When an exception in an event handler is not handled, where does it bubble up to?
It's not bubbling up to anywhere in my Windows Form app. The exception itself gets reported in the debugger output, and the event handler terminates at the offending line of code, and my program runs happily along its way - no "unhandled exception" message is displayed anywhere.
The code doesn't even stop when running hosted/in the debugger. If I wasn't watching the output window, I would have no idea the exception is being thrown.
Is this expected?
I can handle this, I guess, by carefully wrapping all the code in my event handler with Try/Catch. However, I wanted some exceptions to bubble up and be handled in my app - specifically, those *I* throw. But they go nowhere. And I'm realizing... where would they emerge, anyway?
|
|
|
|
|
I have had weirdness like this before when I attached the debugger to running code and there were PDB files from a different build (build and deploy on Monday, lose PDB files on Tuesday, add enough code [spaces] to change the file slightly, rebuild and try to attach to the process on Wednesday). The PDB are similar enough to allow the debugger to attach, but stepping through causes very odd behavior. Of course the solution for this is to either get the original PDB files, or rebuild the assembly and debug with the new ones.
I have also seen cases where the output window shows a slew of "MissingMemberExceptions" or other system looking exceptions that happen in the background and doesnt appear to affect my program's execution. I assume these are thrown by dependant or underlying assemblies and handled down there, before they bubble up to the calling application. The output window may just be blindly dumping any exception data from the CLR.
What kind of exception / details are in the window? Can you cut/paste that and a sample of the code that is executed right before and after the exception shows in the output window?
|
|
|
|
|
I am trying to create an excel chart using reflection. I need to show the chart on a separate form. The chart gets created accurately but the code throws error while copying it to clipboard. Here is the code peice I am using to copy chart to clipboard.
oChartArea = oXLChart.GetType().InvokeMember(
"ChartArea", BindingFlags.GetProperty, null, oXLChart, null);
---> Exception in the line below
---> Exception: Exception has been thrown by the target of an invocation.
---> Inner Exception: Select method of ChartArea class failed.
oChartArea.GetType().InvokeMember(
"Select", BindingFlags.InvokeMethod, null, oChartArea, null);
oChartArea.GetType().InvokeMember(
"Copy", BindingFlags.InvokeMethod, null, oChartArea, null);
oImage = new Bitmap((Image)Clipboard.GetImage());
oPic.Image = oImage;
oPic.SizeMode = PictureBoxSizeMode.AutoSize;
oPic.Left = 10;
oPic.Top = 20;
Clipboard.Clear();
Seeking your help....thanks
|
|
|
|
|
hello,
can i droppeddown all items that i have in a DataGridViewComboBoxCell ?
if it ComboBox we can only set
myComboBox.DroppedDown = true;
but how i can do that in DataGridViewComboBoxCell ?
Thank u
Regards,
Tomi
|
|
|
|
|
Where are your items stored? in c#
Why doesn´t work like that:
ComboBox_Country.Items.Add("France");
ComboBox_Country.Items.Add("Italy");
or in database?
nelsonpaixao@yahoo.com.br
|
|
|
|
|
Hi All,
My requirement is to read an image file from database and to save it as project file (.mpp) file in C# .Net
Many thanks in advance.
Thanks and Regards,
Hariharan C
|
|
|
|
|
Ok, thats your requirement, where's your code?
Write something, post it when it doesn't work and maybe someone will help you.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi All,
I am able to read the file from database and save it as a mpp file. But when i tried to open in MS Project, its saying the following error,
"Project cannot recognize this file format"
The following is my code,
DataSet ds = new DataSet();
SqlConnection con = new SqlConnection("data source=hariharan;
initial catalog=ProjectServer;
integrated security=true");
con.Open();
SqlCommand cmd = new SqlCommand("select reserved_binary_Data
from MSP_PROJECTS where
proj_name = 'TestProject.Published'", con);
cmd.CommandType = CommandType.Text;
SqlDataAdapter ada = new SqlDataAdapter(cmd);
ada.Fill(ds);
byte[] contentArray = (byte[])ds.Tables[0].Rows[0][0];
int len = contentArray.Length;
FileStream docStream = new FileStream("C:\\testing.mpp",
FileMode.CreateNew, FileAccess.ReadWrite);
docStream.Write(contentArray, 0, len);
docStream.Close();
con.Close();
Regards,
Hariharan.
|
|
|
|
|
Are you using the same byte encoding when saving and retrieving?
|
|
|
|
|
Hariharan,
This image you refer to, is it data that is already in Microsoft Project format or is it something you need to convert to that format prior to writing out to the .mpp file.
Alan.
|
|
|
|
|
I sounds rather like the file is not in mpp format.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
I have string
s = "Black";
I want a color object according to this string
ie. I want
Color c = Colors.Black;
so if s = "Red" then c should be Colors.Red
How can I achieve this ?
|
|
|
|
|
Take a look at Color.FromName. I think this does what you want.
|
|
|
|
|
Hi
i want to search inside pdf files (without any traditional component), can anyBody help me ?
thanks.
|
|
|
|
|
I don't know how to do it but apart from googling it I suggest you be more precise; at least I don't quite get your question: what exactly do you mean by "without any traditional component"?
|
|
|
|
|
before post this question, i searched in google and not found useful result.
i mean i want to use free tools.
|
|
|
|
|
It's not as easy as it sounds.
Do you want to search just the plain text?
If so, I can suggest a solution:
Visit this site http://text-mining-tool.com/[^] and download that application.
It a program which uses IKVM to run a java PDF library (PDFBox) and which can extract the text from PDF files. For you, the most useful thing will be the command line utility (minetext.exe), which you can call from your code and it will generate a text file with the contents of the PDF. From there you can search all you want.
BTW, all the programs & tools I've mentioned above are free.
It should work pretty well, though I have encountered some PDF files which could not be understand by the PDFBox component, so I couldn't use them.
Best of luck.
|
|
|
|
|
thanks blackjack2150
but i want search my pdf data in database, and i can't extract each document to drive then search inside it, can anyBody tell me tradional or non-traditional component ?
thanks
|
|
|
|
|
|
Hello
I'm reading an excel file, Now the problem is that when reading it make some cells blanks.
THe reason is that if the first column value is of type text ("0.98ad") then it'll show only data like this format
or when it is numeric (0.8) then it shows only numeric values.
Any idea about it?
Thanks
Syed Shahid Hussain
|
|
|
|
|
Please don't cross post
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hello everyone,
I am new to WCF and I want to learn,
- Basic samples for WCF and I want to deploy a WCF service which serves remote client request;
- How to use PrincipalPermission to control which user role could have permission execute which method.
Any samples to recommend (especially for the 2nd item)?
thanks in advance,
George
|
|
|
|
|
Hey George, did your ISP shut off your access to Google again? Or are you still working that job that pays you by the number of internet forum posts you make?
led mike
|
|
|
|