|
There is no way to make an object up front for a concrete type, since I don't know what is going to be required from Business Unit to Business Unit. I suppose I could add and add as it goes along, but...
I may have to play with that dictionary idea though. I wonder if this would work?
var data = JsonConvert.DeserializeObject<Dictionary<string, string>>(strData);
|
|
|
|
|
Michael Breeden wrote: I wonder if this would work?
Yes, that works.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Fazinating... It does work. Didn't know that.
var data = JsonConvert.DeserializeObject<Dictionary<string, string>>(strData);
A. Worked - made dictionary[string,string]
{"BU":"MRXE","unique_id":"4208","job_id":"1395","track_number":"9012712162","job_count":"1"}
B. Worked - made dictionary[string,object]
{"Parts":{"unique_id":"4208","job_id":"1395","track_number":"9012712162","job_count":"1"}}
C. Failed... even with brackets... I bet it could work..
{"Parts":{"unique_id":"4208","job_id":"1395","track_number":"9012712162","job_count":"1"}}, {"Parts":{"unique_id":"4208","job_id":"1395","track_number":"9012712162","job_count":"1"}}
|
|
|
|
|
Example C is some pretty nasty JSON. Even if you put square brackets around it, you would need to deserialize as a List<Dictionary<string, Dictionary<string, string>>> .
var data = JsonConvert.DeserializeObject<List<Dictionary<string, Dictionary<string, string>>>>(strData);
That would give you a list of two dictionaries, each containing a single key called Parts , the value of which would be a dictionary containing the unique_id , job_id , track_number and job_count .
If the source data is that variable, you'll probably be better off sticking with LINQ to JSON[^].
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Well I should never hit that situation anyway and your suggestion did give a solution to the problem without using a dynamic or needing a concrete object. I like Dictionaries.
Thanks for the suggestion, Mike
|
|
|
|
|
Hi every one
I have project made in Ms access contains over 40 forms
is there any way to convert Forms form access to c#.net (just Forms, I don't need any thing else)
can any one help me!!!
thanks to all
|
|
|
|
|
|
Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...
A very quick search gave over a million hits: convert access forms to c# - Google Search[^]
In future, please try to do at least basic research yourself, and not waste your time or ours.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I know that google is best choice
I spend time to search on google but I didn't find useful answer
so I came to this website
if you think that my question waste your time,simply you could ignore it without answer it
finally thank you for your reply
|
|
|
|
|
I know that google is my best choice
I did search on google but i didn't didn't find useful answer
if you think that my equation waste your time, you could simply ignore it and don't answer it
finally thank you for your answer
|
|
|
|
|
The advice you have been given to post this on a QA forum reflects the fact that traditionally this forum has been more for C# language issues.
Looks to me like you will either have to re-create the Forms/Controls yourself: [^]; perhaps there's a commercial application, but I bet it would be expensive.
Try not to take responses to you here personally; we're here because we wish to assist you and others, and most of us actually enjoy doing that
«There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008
|
|
|
|
|
thank very much for your reply
as you said I found commercial tools to do that but again as you said it's expansive
so I was looking if there is another way
thank you again
|
|
|
|
|
The migration cannot be easily automated. An older (outdated) tool that provides some of that functionality can be found here[^].
40 forms is not very much; I'd recommend a manual migration.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
thank you very much for your reply
|
|
|
|
|
You're welcome
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
In MSDN Application.Idle Event (System.Windows.Forms)[^] one can read concerning using Application.Idle in the paragraph Remarks:
Quote: Caution
Because this is a static event, you must detach your event handlers when your application is disposed, or memory leaks will result.
When an Application is disposed, does it not also mean the app exits? And therefore all objects will be finalized? So I don't see why/where a Memory leak can result...
I don't get the point on the above MSDN description. Can you help me on this?
Thank you in advance.
modified 19-Jan-21 21:04pm.
|
|
|
|
|
A thread is not an application: if you start a console app, then you don't create an Application object, you only do that for Windows apps.
And processing can continue once the Application object is closed - have a look at programs.cs and you will see:
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmMain());
}
}
It is perfectly possible to add code after the Application.Run hass completed, so unless you manually detach your event handler from the static Idle event the Application object and everything it contains can't be disposed.
If you attach to it, you should detach as well just in case of later changes.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Thank you very much for your reply
Yes in case one adds code after Application.Run then it makes sense.
Finally this has completely convinced me to do it:
Quote: If you attach to it, you should detach as well just in case of later changes.
modified 19-Jan-21 21:04pm.
|
|
|
|
|
Hi,
Is it possible to convert a .wmf file to Base64String?
Thanks
|
|
|
|
|
Yes: all files are just a stream of byte values - it's the interpretation that software puts on the internal format of those bytes that makes it a "WMF" or "JPG" file. The extension just indicates what format the software should look for.
string base64 = Convert.ToBase64String(file.ReadAllBytes(@"D:\Temp\myPicture.wmf")); However, that doesn't mean that whatever you pass the base64 string to can do anything useful with it. For example, not all browsers support WMF file data in any format, and changing it to Base64 will not fix that. WMF is pretty much a "Windows only" image format: you would probably be better off using a more generic format such as JPG, GIF, or PNG.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
wow! that's just in one line!!!
Thanks very much!
How do I load it back to a form? 
|
|
|
|
|
|
Thanks! 
|
|
|
|
|
You're welcome!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I more concern.
I want the metafile to be created in memory rather than saving to a disk. It should be a blank metafile. I assume it is like this.
metfile = New Metafile(hdc, EmfType.EmfPlusDual)
|
|
|
|