|
I bribed him.
Hi Luc! Been a while ... how are you doing?
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I'm fine thanks; I am enjoying car forums, pie day, and all things "smooth and orderly"...
|
|
|
|
|
Luc Pattyn wrote: I am enjoying ... pie day
... but only to four significant digits!
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
float? double? float converted to double?
|
|
|
|
|
I'm new to programming.
I've created a ListView1 in C#
This ListView1 contains the columns: Student, DOB, and Location.
There are different groups. Each student is grouped together with other students sharing the same age group.
The DOB field is in date format representing date of birth of each student.
Student DOB Location
Group1
AAA 10-05-2000 Mumbai
BBB 05-02-2000 Pune
CCC 01-01-2000 Delhi (youngest)
Group2
DDD 20-03-1999 Lucknow (youngest)
EEE 15-06-1999 Chennai
FFF 18-09-1999 Ahmedabad
Can you please help me with the Code to automatically delete all items except the youngest student in each of the groups (by comparing DOB)?
Thanks a lot in advance. :)
|
|
|
|
|
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.
So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Get the youngest in each group; which is the same as what you're asking.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
An amazingly inane comment. Downvoted.
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
Either:
1. create a structured database, and bind the ListView to it.
or
2. create appropriate class objects and bind the ListView to a collection object class that maps to the ListView column structure.
There are lots of resources here: [^]
and, on the web: [^] to help you learn how to use databinding.
Once you have the ListView databound, then you either execute a command/query on the database, or you do something like this using Linq:
IEnumerable<Student> earlydatestudents = Students.GroupBy(std => std.Group)
.Select(grp =>
{
DateTime dt = grp.Min(s => s.DOB);
return grp.Where(st => st.DOB == dt);
})
.SelectMany(slist => slist);
var toDeleteList = Students.Except(earlydatestudents).ToList();
Note the above code will possibly return more than one student ... you could have students with the same birthdate in each group. You should implement IEquatable in your 'Student Class to do comparison based on more than just the birthdate (DOB) property.
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
modified 15-Mar-19 23:34pm.
|
|
|
|
|
If you send plain Json formatted un-serialized text from a web api and have it be de-serialized in a C# function using the jsonConvert.DeserializeObject functional? I have a co-worker who created a web api in the cloud and he sends plain text formatted to look like un-serialized Json which I try to use C# functionality to Deserialize but when I try to convert what is sent into Model classes it fails. I am telling him that the C# JsonConvert.SerializeObject must be used or it won't work. Can someone help clarify this with me?
This is what is being sent:
This is what is being sent: { [ \"accesspoint\" : { \"api\" : \"test\"} ] }
modified 13-Mar-19 18:17pm.
|
|
|
|
|
That isn't valid JSON, even if you remove the "\" characters that aren't really there (they are added by VS to show the double quotes).
That doesn't mean he's trying to send you JSON at all - so talk to him, and ask him what exactly he is trying to send.
If it is JSON and he generates it himself, then he needs to generate code that will work with this: json2csharp - generate c# classes from json[^] or no "real" JSON deserializer will work.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hi guyss, I have a listview that loads the data of the Menu table in the database (MsSql 2012). The table has four columns ID, Product, Price and Quantity. So i am trying to make the rows of each items in the listview that will go red if the quantity in the database is 0. I've set the quantities of each Products so that i can identify if it will work.Apparently this is my code right now, but nothing happens when i put the method redRowL in the Form1_Load.
Note: The listview only loads the ID, Product and Price.
public void redRowL()
{
try
{
foreach(ListViewItem item in listView2.Items)
{
SqlConnection cn = new SqlConnection();
con.Open();
string qwe = "Select " + item.SubItems[0].Text + " from Menu where Quantity = 0";
SqlCommand cmd = new SqlCommand(qwe, con);
dr = cmd.ExecuteReader();
while (dr.Read())
{
item.BackColor = Color.Red;
}
}
}
catch
{
MessageBox.Show("Rows are Red , Your eye is Blue, What will yo do if im inlove with you?", "PHugOts Error");
}
con.Close();
}
|
|
|
|
|
Firstly, don't do it like that! Never concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Always use Parameterized queries instead.
When you concatenate strings, you cause problems because SQL receives commands like:
SELECT * FROM MyTable WHERE StreetAddress = 'Baker's Wood' The quote the user added terminates the string as far as SQL is concerned and you get problems. But it could be worse. If I come along and type this instead: "x';DROP TABLE MyTable;--" Then SQL receives a very different command:
SELECT * FROM MyTable WHERE StreetAddress = 'x';DROP TABLE MyTable; Which SQL sees as three separate commands:
SELECT * FROM MyTable WHERE StreetAddress = 'x'; A perfectly valid SELECT
DROP TABLE MyTable; A perfectly valid "delete the table" command
And everything else is a comment.
So it does: selects any matching rows, deletes the table from the DB, and ignores anything else.
So ALWAYS use parameterized queries! Or be prepared to restore your DB from backup frequently. You do take backups regularly, don't you?
Secondly, if I do much what you have there, it works fine:
listView1.Items.Clear();
listView1.Items.Add("aaa");
listView1.Items.Add("bbb");
listView1.Items.Add("acc");
listView1.Items.Add("ddd");
int itemCount = 0;
foreach (ListViewItem item in listView1.Items)
{
if ((itemCount++ & 1) == 0) item.BackColor = Color.Red;
}
So start by checking with the debugger exactly what is happening - at a guess, you have no items loaded into your ListView but without being able to run your code through the debugger and with your data available, we can't tell.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
佳能相机怎么得到焦距,[How to get the focal length of Canon camera]
int focallength = MainCamera.GetInt32Setting(PropertyID.FocalLength);
返回错误属性不可用 [Return error attribute is not available]
[Google translate]
modified 13-Mar-19 2:51am.
|
|
|
|
|
This is an English language site, and we can only respond to questions in that language. Please use Google Translate (if available in China, I don't know what your government allows you behind the Great Firewall).
I have modified your question.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
The focal length isn't a property of the camera so you can't retrieve it - it's embedded in the image instead. Have a look at Canon EDSDK Tutorial in C#[^] to see how to get this.
This space for rent
|
|
|
|
|
|
First of all, thank you for your answer. I looked at the link you gave me, used the demo inside, and returned the error not supported.I hope you can help me Solve the problem。
The code is as follows:
ErrorCode err;
IntPtr inStream;
err = CanonSDK.EdsCreateFileStream(filename, FileCreateDisposition.OpenExisting, FileAccess.Read, out inStream);
IntPtr imgRef;
err = CanonSDK.EdsCreateImageRef(inStream, out imgRef);
|
|
|
|
|
how to add multiple drop down in excel file. suppose i have n number of questions and for each question can have different number of answers. So i want to create drop down for answers
|
|
|
|
|
Does this have anything to do with C#? If so please add the details to your question.
|
|
|
|
|
yes, using c# i am trying to create excel file. suppose i am creating question paper, which can have different questions and each question will have set of different answers. so for one set of answers i want drop down
|
|
|
|
|
|
Is it enough methods for capture and report JavaScript errors on web page on computer and mobile devices?
window.onerror = function (msg, url, lineNo, columnNo, error) {
return true;
};
|
|
|
|
|
Wrong forum - this is for C#, as it says at the top of the page...
Try here: JavaScript Discussion Boards[^]
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|