|
Hi,
you can use the TryParse() method of int, uint, long, ulong depending on the range you want to support; and some overloads will let you choose options, e.g. allowing thousand separators.
Warning: TryParse() will always fail on an empty TextBox.
similar for reals (float, double), dates, etc.
everything in a TextBox is a string.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
thanks alot problem solved 
|
|
|
|
|
|
|
I am tryng to serialize the IP's Server Addresses in my Lan using objects IPHostEntry for getting better the communications with them, later I need that the machines which are going to connect with such Server Serialize and Deserialize the Server's List, but when I try to serialize, both in binary or XML, I receive an error telling me that such object IPHostEntry is not marked as Serializable.
Any suggestion for avoiding this problem
Note: I Create a Dictionary<string, iphostentry=""> containing the name and IP data of every Server and such is the object which I want to Serialize, if the key and value are both strings there is no problem, but when I change to Type IPHOstEntry it does not work.
Regards
|
|
|
|
|
|
0) UPDATE INTO -- nope
1) colErrByUserID = '" + LoginForm.gb_strUserID + "' "; -- very bad idea
|
|
|
|
|
Thanks for that!
Very useful, not!
So what you are really saying is you don't know...

|
|
|
|
|
No, I'm just not going to spoon-feed you. You'll find very few people here who will.
|
|
|
|
|
Thats right you, keep telling yourself that!

|
|
|
|
|
|
I am having an XMl like below
<Details>
<det id=1 name="abc">
</Details>
Now i want to take the above xml as input and to repeat the node
like below using C#
<Details>
<det id=1 name="abc"/>
<det id=2 name="abc"/>
<det id=3 name="abc"/>
</Details>
|
|
|
|
|
|
Rich,
Just I want to repeat the node in aloop by incrementing id.
|
|
|
|
|
I don't understand what your problem is. What code are you using to create the original XML, and what code have you tried to create the repeat items?
|
|
|
|
|
Rich,
In c#.Original xml is a string which I get like below
<details>
<detail id="1" name="x"/>
</details>
I want to take that xml string and to repeat the nodes
foreach xml nodes
<details>
<detail id="1" name="x"/>
<detail id="2" name="x"/>
<detail id="3" name="x/>
</details>
id=2 and id=3 is repeated.want to do it in C#
|
|
|
|
|
That can be easly done using XmlDocument.
You know that class? Have you already tried something or you want us to give all the code to you (that you won't get here, I'm afraid)?
|
|
|
|
|
kurangu wrote: In c#.Original xml is a string which I get like below
Where do you get this from, a const string, XmlReader, TextReader?
kurangu wrote: I want to take that xml string and to repeat the nodes
I ask again, what code have you tried; please help us to understand better what you are actually doing in your code?
|
|
|
|
|
HI,
It's a constant string.
string a =
"<SecDetails><Security PrimarySecID=\"abcd\" Price=\"12\"/></SecDetails>";
XmlDocument originalXml = new XmlDocument();
originalXml.LoadXml(a);
XmlNodeList nodelist = originalXml.SelectNodes("/SecDetails/Security");
foreach (XmlNode xn in nodelist)
{
here I should be able to repeat the node
for (int i=1; i<=10;i++)
{
I am struck here.
}
}
|
|
|
|
|
|
Now I'm even more confused, I don't see a relation between what you have posted here, and the XML statements from your original post.
If you are saying that you don't know how to format a string in C# then I suggest you look at the documentation for the String class.
If you are unsure of the Xml data formats then look at the items referred to by Mirko1980.
If you are having trouble understanding the for or foreach statements then take a look at the C# documentation.
|
|
|
|
|
Hello,
I wanted to make a small game.. but I noted that the (X,Y) of the mouse and the button, if you are at the same pixel, are different. Look at the picture:
Here I'm pointing in the center of the button (where the red point is..) and the (X,Y) of both of them are different:
http://i34.tinypic.com/2ur9nx3.jpg[^]
Here I'm out of the button and its the same (X,Y) (red point..):
http://i37.tinypic.com/311tatz.jpg[^]
So why is this happening, and most importantly, how to fix this?
Thanks.
|
|
|
|
|
I don't understand the question..
Why would the position of the button change? Only the position of the mouse cursor would change when you move the mouse...
|
|
|
|
|
I mean that when I put the mouse over the button, they both should have the same (X,Y).. but thats not happening..
Why is that?
|
|
|
|
|
I'd have to see some code, as I'm not able to duplicate your error.
|
|
|
|