|
Message=Unable to cast object of type 'Newtonsoft.Json.Linq.JObject' to type 'Newtonsoft.Json.Linq.JArray'.
That suggests that the line:
return JsonConvert.DeserializeObject<JArray>(s);
should be
return JsonConvert.DeserializeObject<JObject>(s);
Also, your return value above, s , is a string (i.e. object) rather than an array by the look of the code.
|
|
|
|
|
Thanks Rich! Much Appreciated very new to this. The JObject replacement has allowed the code to actually grab the information which is 'S' and you are correct it is a string.
Do you know of a better process to deserialize that string into the datagridview?
Right now it is still not returning the information to that datagridview.
|
|
|
|
|
Sorry, I don't really know JSON, the error message was the clue. I suggest you go back to the documentation and see if that helps.
|
|
|
|
|
Thanks Rich Ill dig deeper! Much appreciated.
|
|
|
|
|
Hi there,
I have a question, perhaps there is somebody who has done something similar.
I am need to work on something that could be a WYSWIYG (or at least partially WYSIWYG) editor of SVG elements on an xhtml files.
The background is - I've got epub books for which I have a semi-wysiwyg editor. You edit the xhtml file in one window, and the embedded browser reflects the changes live. This is for translation of the text. Now, some of the text is fancy, whirly and bendy and it is not in regular span elements, but rather in SVG:
<svg id="svgRoot" version="1.1" baseProfile="Full" width="783px" height="957px" viewBox="0 0 648 792" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">
<g clip-path="url(#clp1)" transform="matrix(1 0 0 -1 -0 792)" fill="currentColor" style="color: #F37322;">
<text transform="matrix(0.83072216 0.55668724 0.55668724 -0.83072216 165.6 449.35)" font-family="'BurbankBigRegularLight'" font-size="22"><tspan x="0" y="-0" class="ps01 ps22">Sample text bit</tspan>
</text>
</g>
</svg>
What I need to do is to edit the text (simple), but also move/twist the text visually on the page. Any idea if there's a simple and free c# library that would allow such manipulation?
Thanks!
|
|
|
|
|
when I use openssl to generate a cert and a private key which has a password, how can I use c# to use the cert to use the cert to encrypt infomation and use the key to decode information?
|
|
|
|
|
|
|
Firstly your URI is broken.
Secondly, what does this have to do with C#?
|
|
|
|
|
Not a default control, but could easily be done using a DataGridView.
Dunno about DevExpress; you'd have to browse their products.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
It's a grid of some form. You could simulate this in .NET (WinForms) with either a DataGridView, or a TableLayoutPanel, or even a ListView, or by using UserControls.
The form and contents of the grid suggest this is a "Decision Table:" [^], but that's a guess ... I can't read Vietnamese.
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|
I write on the winform, I'm looking for this control. It looks like a ListView with grouping functionality in use, although you'd need a bit of custom code to display the check boxes because the ListView control only supports check boxes in the first column. you have an example of this control share with me
|
|
|
|
|
Server/html controls are not real controls. Source tags stays on server side and therefore image on client side doesn't help a lot.
Instead of this you should check html source and try to reveal base engine(if possible).
As much as I know DevExpress is made for ASP.Net and ASP.Net only.
If this is DevExpress control then you MUST go to www.devexpress.com,
login and post your question there, but ...
... threre is bunch of controls in their package and what is on your picture can be achived on too many ways, so I don't think you are to lucky about this issue.
|
|
|
|
|
What are you on about? He's just asked what type of control this is. It doesn't have any indication that this is a web control.ngoj wrote: As much as I know DevExpress is made for ASP.Net and ASP.Net only You're wrong. DevExpress make controls for a wide variety of platforms.
|
|
|
|
|
Thanks, it is good to know
|
|
|
|
|
Can anybody explain to me the benefits, if any, to using var to declare stuff. I don't see the point, but it's popping up more and more. See the two examples below:
using (SqlConnection dbConnection = new SqlConnection(connString))
{
using (SqlCommand dbCommand = new SqlCommand("SELECT * FROM [TableName]", dbConnection))
{
using (SqlDataReader dbReader = dbCommand.ExecuteReader())
{
while (dbReader.Read())
{
}
}
}
}
using (var dbConnection = new SqlConnection(connString))
{
using (var dbCommand = new SqlCommand("SELECT * FROM [TableName]", dbConnection))
{
using (var dbReader = dbCommand.ExecuteReader())
{
while (dbReader.Read())
{
}
}
}
}
|
|
|
|
|
The use comes from when Linq was introduced; it will be type-safe, based on the type the IDE derives form what you put in there. It can be used both to make code more readable, and to make code harder to read.
I would also like to point out that you can simply use the factory-method on the connection to create a command; and those should not have been "var" typed, but simply the appropriate interfaces.
--edit
MSDN[^] has a better explanation than I do, ofc
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
modified 16-Sep-15 8:50am.
|
|
|
|
|
When the type is obvious, using var means you don't have to repeat the type:
var someDictionary = new Dictionary<string, List<Expression<Func<IEmployee, bool>>>>(StringComparer.OrdinalIgnoreCase);
Dictionary<string, List<Expression<Func<IEmployee, bool>>>> someDictionary = new Dictionary<string, List<Expression<Func<IEmployee, bool>>>>(StringComparer.OrdinalIgnoreCase);
When the type is not immediately obvious, but isn't integral to understanding the code, then it's a matter of personal preference or style guidelines:
using (var dbReader = dbCommand.ExecuteReader())
using (SqlDataReader dbReader = dbCommand.ExecuteReader())
(In this example, if you change the type of dbCommand , the var sample would just work, but the SqlDataReader would generate a compiler error until you changed the type of dbReader as well.)
In most cases where the type is not obvious, you should try to avoid using var :
var list = GetFoo();
List<Customer> list = GetFoo();
However, proper method and variable names would make the code clearer:
var listOfCustomers = GetListOfCustomers();
And finally, if you're using anonymous types, then you have to use var :
var listOfNames = listOfCustomers.Select(c => new { c.FirstName, c.Surname });
(Anonymous types are the reason var was introduced.)
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: (In this example, if you change the type of dbCommand , the
var sample would just work, but the SqlDataReader
would generate a compiler error until you changed the type of
dbReader as well.) That must be why we usually program against the base-class, putting the SqlDataReader into variable of type DbDataReader, or against its interface, IDataReader.
Declaring those as "var" means that the type may not what you expect it to be. If it offers no advantage to use var, then it might be wise to be precise.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Yes, please use the Interfaces.
|
|
|
|
|
It's for use with anonymous types -- where you can't know the type when you write the code.
Don't use it any other time.
|
|
|
|
|
Well said, that man.
Regards,
Rob Philpott.
|
|
|
|
|
PIEBALDconsult wrote: Don't use it any other time.
Absolute rules have absolutely no place in programming.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Good responces to all. Thanks for the feed back. So, when I see something like:
for (var i = 0; i < 10; i++)
{
}
that's just stupid.
|
|
|
|
|
In most cases, var is just a form of laziness but, in this case, replacing a three letter keyword with another three letter keyword really is bonkers (or it's a sign that they haven't customized Resharper which prompts you to change explicit types to use var).
|
|
|
|