|
You do realise that the original poster doesn't get replies to questions when you reply to someone else, don't you? I don't think Dave's particularly in need of doing this.
|
|
|
|
|
Pete is correct. Why are you telling ME this??
I already know this stuff, and, frankly, would NEVER use a parallel port to control anything as it's too easy to blow the port up. I'd use hardware dedicated to the purpose like something from Phidgets or a Netduino or Arduino.
Since the original poster never specified what they were using as an "LED display" the question is unanswerable. I really don't feel like going through every possibility of scrolling an image on every type of "LED display" as it would take a small book to describe them all.
|
|
|
|
|
Hello I am new to xml. I want to read the data from xml file. Here is my xml code :
<overseas_sales>
<overseas_sale_ad>
<country>Spain</country>
<area>Costa Blanca South</area>
<property_type>house</property_type>
<price>95000</price>
<price_type>region</price_type>
<bathroom_number>2</bathroom_number>
<bedroom_number>2</bedroom_number>
<property_status>for-sale</property_status>
<external_id>R214</external_id>
<photos>
<photo>http://www.solmarestates.com/images/propimages/R2141.jpg</photo>
<photo>http://www.solmarestates.com/images/propimages/R2142.jpg</photo>
<photo>http://www.solmarestates.com/images/propimages/R2143.jpg</photo>
<photo>http://www.solmarestates.com/images/propimages/R2144.jpg</photo>
<photo>http://www.solmarestates.com/images/propimages/R2145.jpg</photo>
<photo>http://www.solmarestates.com/images/propimages/106_1218710541.jpeg</photo>
<photo>http://www.solmarestates.com/images/propimages/106_1218710543.jpeg</photo>
<photo>http://www.solmarestates.com/images/propimages/106_1218710546.jpeg</photo>
</photos>
</overseas_sale_ad>
Now I want to get all photos in a list . I am trying with code :
XmlNode root = PropertyDocument.SelectSingleNode("//overseas_sales");
XmlNodeList nodeList = root.SelectNodes("overseas_sale_ad")
ArrayList ElementsList = new ArrayList();
foreach (XmlNode n in nodeList)
{
if (n.SelectSingleNode("external_id").InnerText == ID)
{
XmlNodeList photos = n.SelectNodes("photos");
foreach(XmlNode ph in photos)
{
ElementsList.Add(ph.SelectSingleNode("photo").InnerText);
}
}
}
But I am getting url of only first photo. I want to get them all in "ElementList". Can anyone help?
|
|
|
|
|
Well yes. That is what I would expect - you only have the one "photos" node. You need another loop:
XmlNode root = PropertyDocument.SelectSingleNode("//overseas_sales");
XmlNodeList nodeList = root.SelectNodes("overseas_sale_ad");
ArrayList ElementsList = new ArrayList();
foreach (XmlNode n in nodeList)
{
if (n.SelectSingleNode("external_id").InnerText == ID)
{
XmlNodeList photos = n.SelectNodes("photos");
foreach (XmlNode ph in photos)
{
foreach (XmlNode photo in ph.SelectNodes("photo"))
{
ElementsList.Add(photo.InnerText);
}
}
}
}
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Thank you so much, adding another loop solved my problem.
|
|
|
|
|
You're welcome!
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
You need to use SelectNodes to get them, not SelectSingleNode , and I would use one loop:
foreach(XmlNode ph in nodeList.SelectNodes("//overseas_sale_ad[external_id='R214']/photos/photo"))
{
ElementsList.Add(ph.InnerText);
}
Brush up on XPath.
I would also use a List<string> rather than an ArrayList -- no one uses ArrayList anymore.
|
|
|
|
|
'System.Xml.XmlNodeList' does not contain a definition for 'SelectNodes' and no extension method 'SelectNodes' accepting a first argument of type 'System.Xml.XmlNodeList' could be found (are you missing a using directive or an assembly reference?)
Thank you for your reply. I am getting this error. But no problem I got my solution
|
|
|
|
|
Oh, yeah, you need a node. No biggy. You should still only need one loop.
faiza.butt89 wrote: I got my solution
modified 30-Jul-12 9:51am.
|
|
|
|
|
I am using myform.Activate() to activate MDI Child form and running a code on activation. what is the form already active? is it possible to re-activate so my code will run again on activation?
|
|
|
|
|
Move the code to it's own method.
You're depending on a simple specific behavior of a form to trigger the exection of code that needs to be triggered under varying circumstances. move the code to it's own method so you can call it from Form.Activate and other events as needed. I have no idea what you're doing or why this code needs to be executed on Activate so it's impossible to suggest something appropriate.
The only way to get Activate to fire again is to make another form active and then make your target form active again. The problem with that is the active form will redraw itself to be on top or your real target form and then the target form will again redraw itself on top of the others, making your form "flash".
|
|
|
|
|
I have a page with a few validation controls and a ValidationSummary control. Most of the validation controls are RequiredFieldValidator controls and the summary control displays these messages just fine.
I do have a RegularExpressionValidator that checks for the format of an email address. If the address isn't entered correctly my error message from this control isn't being displayed by my summary control.
I know the problem isn't with my regular expression as I can display the error message by the regex control if I change the Display setting.
ValidationSummary doesn't just work with RequiredFieldValidator does it? That would be less than helpful.
My code :
<asp:ValidationSummary ID="ValidationSummary1" ValidationGroup="Test" HeaderText="You must enter a value in the following fields:"
DisplayMode="BulletList" EnableClientScript="False" runat="server" />
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ValidationGroup="Test" ControlToValidate="txtReqDuration"
ErrorMessage="Enter a valid number" Display="None" ValidationExpression="^([\d]{0,2})$"></asp:RegularExpressionValidator>
Thanks.
|
|
|
|
|
You already posted this in the ASP.NET forum; please do not multi-post the same issue.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
i put this code in textbox_textchanged and textbox_editvaluechanged, both didn't work.
yes i'm new in C#, but i think this is so simple.
is this a problem in threading
string uppercase = this.txtLicense.Text.ToUpper();
this.txtLicense.Text = uppercase;
i'm not sure i need to create a new thread just to force a textbox uppercase.
|
|
|
|
|
Midnight Ahri wrote: is this a problem in threading
No it is not a problem with threading unless you did not reveal all of the information.
Midnight Ahri wrote: both didn't work
"didn't work" does not tell us anything about the problem that you are having. You should know this by now.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
modified 27-Jul-12 23:52pm.
|
|
|
|
|
You need to use LostFocus event to do the same.
Thanks
-Amit Gajjar (MinterProject)
modified 28-Jul-12 0:16am.
|
|
|
|
|
well, thank you very much for trying.
i realize it's not that hard to answer this,
character casing properties fix my problem.
modify :
"i'm not sure i need to create a new thread just to force a textbox uppercase."
thank you for the reply, but i'm sure you understand it.
don't worry, next time i will write it more detail.
modified 28-Jul-12 0:13am.
|
|
|
|
|
Midnight Ahri wrote: this.txtLicense.Text = uppercase;
What does this line do, besides the obvious things? Well, it sets the value of a textbox.
..which means that the value has changed. If the value changes, the Framework will trigger the "textbox_textchanged" event. So, we execute that code - which tells us to change the value again. (See a pattern?)
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
After the second bounce the value will not change so the event shouldn't fire forever.
|
|
|
|
|
Does the setter of the text-property of the textbox include a check to see whether the value is the same, or not?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
It should, at least for the TextChanged event (the clue's in the name!), but I haven't actually tested it right now.
|
|
|
|
|
BobJanova wrote: It should, at least for the TextChanged event (the clue's in the name!)
The times that I programmed against a intID where the clue in the name was erroneous..
You are right, I decompiled the TextBox, which points to TextBoxBase, which has this in the setter implementation;
this.has_been_focused = false;
if (value == this.Text)
{
return;
}
(Śtill untested)
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Is this a desktop or web app?
|
|
|
|
|
Probably a bit late now, but the normal way to do this is to intercept the character before it makes it into textbox rather than trying to alter it once its there.
To do this, you want to intercept the WM_CHAR message (either by hooking the event KeyPress at form level of overriding a virtual OnKeyPress(Or similiar?) in a class deriving from TextBox. Then check the character and if its in the range a-z alter it to be A-Z (By subtracting 32 simplest way if ASCII).
edit: That is of course assuming this is Winforms, an assumption I may have jumped on too soon as Bob mentions above.
Regards,
Rob Philpott.
|
|
|
|
|
Hi Friends,
I am trying to create a new thread to make the picturebox is visible (to show Loading icon) when the ConvertFiles method is running, but it is not successful (Please see below codes)
Do you know what's wrong ?
private void ShowLoadingIcon()
{
if (InvokeRequired)
{
this.Invoke (new MethodInvoker( ShowLoadingIcon));
}
else
{
pixLoadingIcon.Visible = true;
}
}
private void btnConvert_Click(object sender, EventArgs e)
{
Thread thLoading = new Thread(ShowLoadingIcon);
thLoading.Start();
ConvertFiles(sourceFile, destinationFile);
}
Thanks and regards,
|
|
|
|