|
|
|
Great site, just noted it for future use
I have no smart signature yet...
|
|
|
|
|
I smelt it +5
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Dont the same Question in Different Forums
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hi All
Can anyone suggest how can we find the checkboxes inside checkedlistbox.
Iam not speaking about the checked item inside the checkedlistbox instead i need to find each and every checkbox controls included in the checkedlistbox
Thanks in advance
Santhosh
|
|
|
|
|
I am afraid, you can not access that checkboxes inside the checkedlistbox.
But as a last resort we can try using checkedlistbox.Controls property and enumerates the child controls to see if you can get hold of that checkbox. But still I am sure that won't be of much help.
|
|
|
|
|
Anindya thanks for the reply
<code>
foreach (CheckBox c in chkListboxPermission.Controls)
{
}
</code>
As you said this is not providing me the desired result..
Santhosh
|
|
|
|
|
What is it you are trying to do?
|
|
|
|
|
|
I have added 4 pictures to a resource file which I want to compare with the image in a picture box
An example of what I want to do is:
if (pictureBox1.Image == resourceFile.Image1)
{
pictureBox1.Image = resourceFile.Image2;
}
else
{
pictureBox1.Image = resourceFile.Image1;
}
This code compiles but the else-statement always executes.
How do I make this work?
|
|
|
|
|
try using pictureBox1.Image.Equals
|
|
|
|
|
Have already tried, it didn't work =(
Thanx anyway
|
|
|
|
|
That is because the equality operator only valid for the same objects not for the same contents. Though your pictures' contents are same but as they are two different objects in the memory, that is why the control always goes to the else block.
Now comparing the two images is not so simple.
One way to do is to save the two images in two different MemoryStream using
var ms = new MemeoryStream();
image.Save(ms, System.Drawing.Imaging.ImageFormat.MemoryBmp);
byte[] byteArray = ms.ToArray();
Do the same thing for the other image also and then check the equality of two byte arrays by reading each byte.
Hope this will solve your problem.
|
|
|
|
|
Actually i guess Image don't have any implementation for Equals method, so it fails. Byte check should work then.
|
|
|
|
|
Didn't work! This is what I got from your code example.
"Tarning1" is one picture in the resource file.
"bild" is the picture box name.
System.IO.MemoryStream ms1 = new System.IO.MemoryStream();
Bitmap pic1 = new Bitmap(bild.Image);
pic1.Save(ms1, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] byteArray1 = ms1.ToArray();
System.IO.MemoryStream ms2 = new System.IO.MemoryStream();
Bitmap pic2 = DicePictures.Tarning1;
pic2.Save(ms2, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] byteArray2 = ms2.ToArray();
if (byteArray1 == byteArray2)
Console.WriteLine("Equal");
else
Console.WriteLine("Not equal");
Did I miss something?
|
|
|
|
|
Some remarks for your code.
1. Use Image class directly instead of Bitmap. And don't use Jpeg format use MemoryBmp, it will ease byte comparing.
bild.Image.Save(ms1, System.Drawing.Imaging.ImageFormat.MemoryBmp);
2. Don't use
if(byteArray1 == byteArray2)
coz you are doing the same wrong thing again. I told you to compare byte by byte using looping like as follows
if(byteArray1.Length == byteArray2.Length)
{
for(int i = 0; i < byteArray1.Length; i++)
{
if(byteArray1[i] != byteArray2[i])
return false;
}
return true;
}
return false;
Hope this will give you the desired result.
|
|
|
|
|
We tried that but,
bild.Image.Save(ms1, System.Drawing.Imaging.ImageFormat.MemoryBmp);
Returns an ArgumentNullException. "Value cannot be null, parameter name: encoder".
I guess the MemoryBmp ImageFormat is null or something.
Didn't you get this exception?
|
|
|
|
|
Use System.Drawing.Imaging.ImageFormat.Bmp instead. Here is the test code
Image img1 = pictureBox1.Image;
Image img2 = pictureBox2.Image;
MemoryStream ms1 = new MemoryStream(), ms2 = new MemoryStream();
img1.Save(ms1, ImageFormat.Bmp);
img2.Save(ms2, ImageFormat.Bmp);
byte[] byteArray1, byteArray2;
byteArray1 = ms1.ToArray();
byteArray2 = ms2.ToArray();
if (byteArray1.Length == byteArray2.Length)
{
for (int i = 0; i < byteArray1.Length; i++)
{
if(byteArray1[i] != byteArray2[i])
MessageBox.Show("Not Same");
}
MessageBox.Show("Image Same");
}
else
MessageBox.Show("Not Same");
Inform me if it solves the problem.
|
|
|
|
|
It didn't work, but I will find another way to do it.
Thank you for all your help.
|
|
|
|
|
Try this one!!
it works for me!
bool b = false;
for (int i = 0; i < 255; i++)
{
if (pictureBox_OK.Image.Palette.Entries[i] == Properties.Resources.OK.Palette.Entries[i])
{
b = true;
}
else
{
b = false;
break;
}
}
|
|
|
|
|
Hi, In the below XML file, I would like add an element
studentMarks with attribute Total=100, where the Student ID=101.
I tried with InsertAfter method, but it didn't work.
Please guide me, Thanks in advance.
<? xml version = "1.0″ encoding = "UTF-8″?>
<StudentRecords>
<SpecialStudent id=555>
<StudentName> John Trivolta </StudentName>
<StudentSubject> Science </StudentSubject>
<SpecialStudent>
<Student ID=100>
<StudentName> John Trivolta </StudentName>
<StudentSubject> Science </StudentSubject>
</Student>
<Student ID=101>
<StudentName> Bruce Lee </StudentName>
<StudentSubject> Computer </StudentSubject>
</Student>
<Student ID=102>
<StudentName> North V </StudentName>
<StudentSubject> Maths</StudentSubject>
</Student>
<StudentRecords>
|
|
|
|
|
1. Get the XMLNode Student (of ID 101)
2. Get XMLNode StudentSubject
3. Call InsertAfter of Student node and pass StudentSubject node as reference node
4. And don't forget to save document
If you this didn't help, post ur code here to analyse
|
|
|
|
|
Thanks for the reply. Please look at my code. I'm getting exception at below line.
xmlDoc.DocumentElement.InsertAfter(newcatalogentry, refNode);
Exception message: "The reference node is not a child of this node."
XmlTextReader xmlReader = new XmlTextReader(Application.StartupPath + "\\doc.xml");
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(xmlReader);
xmlReader.Close();
string xpath = string.Format("/StudentRecords/Student");
XmlNamespaceManager nsmgr = new XmlNamespaceManager(xmlDoc.NameTable);
XmlNodeList fieldNodes = xmlDoc.SelectNodes(xpath, nsmgr);
string refName = "";
int index = 0;
XmlAttributeCollection ddd;
XmlNode refNode = null;
string studentID;
foreach (XmlNode node in fieldNodes)
{
ddd = fieldNodes[index].Attributes;
studentID = ddd["ID"].Value.ToString();
if (Convert.ToInt32(studentID) == 101)
{
refNode = node.SelectSingleNode("StudentSubject");
}
}
XmlDocument xmldoc = new XmlDocument();
XmlElement newcatalogentry = xmldoc.CreateElement("StudentMarks");
XmlAttribute newcatalogattr = xmldoc.CreateAttribute("Total");
newcatalogattr.Value = "100";
newcatalogentry.SetAttributeNode(newcatalogattr);
xmlDoc.DocumentElement.InsertAfter(newcatalogentry, refNode);
string path = "C:\\test.xml";
FileStream fsxml = new FileStream(path, FileMode.Truncate,
FileAccess.Write,
FileShare.ReadWrite);
xmlDoc.Save(path);
|
|
|
|
|
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(Application.StartupPath + "\\doc.xml");
string xpath = string.Format("/StudentRecords/Student");
XmlNodeList fieldNodes = xmlDoc.SelectNodes(xpath);
XmlNode studentNode = null;
XmlNode refNode = null;
foreach (XmlNode node in fieldNodes)
{
if (node.Attributes["ID"].Value == "101")
{
studentNode = node;
refNode = node.SelectSingleNode("StudentSubject");
}
}
if (studentNode != null && refNode != null)
{
XmlElement newcatalogentry = xmlDoc.CreateElement("StudentMarks");
XmlAttribute newcatalogattr = xmlDoc.CreateAttribute("Total");
newcatalogattr.Value = "100";
newcatalogentry.SetAttributeNode(newcatalogattr);
studentNode.InsertAfter(newcatalogentry, refNode);
string path = "C:\\test.xml";
xmlDoc.Save(path);
}
updated within post area, test it at your end
|
|
|
|