|
All right all right , use the method best suited and all that, depends what you are doing etc etc....
I just find I use TryParse followed by an if check much more often than Parse, but maybe that's just me.
Simon
|
|
|
|
|
The difference between using TryParse and Parse is that if you expect that it will fail (e.g. you are using it to validate and convert user input) then you should use TryParse . If you expect that it will always work then use Parse (e.g. you are parsing a value from an XML file where the schema says it is an integer).
|
|
|
|
|
I generally use this format for all the conversions, I never use Convert any more as I think it is just more lines of code than are necessary:
int num = 0;
string hold = "123";
if(!Int32.TryParse(hold, out num))
{
}
Keep It Simple Stupid! (KISS)
|
|
|
|
|
Simon Stevens wrote: Like Alan says - No difference.
For this case yes, but be careful with the overload taking an object as the following will show you:
Convert.ToInt32(false) => 0
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
I generally avoid Convert.
|
|
|
|
|
if strNumber is null, Int23.Parse throws an exception while Convert.ToInt32 returns 0.
|
|
|
|
|
these days, I just know that chart control supported by Framework 3.5, it seems this control is very powerful!
before I am using Zedgraph code, now I think chart control can be used instead!! Am I true?
|
|
|
|
|
Well the charting control allows you do draw charts, and yes it is probably very similar to zedgraph. But only you can answer if it does everything exactly as you need it to do.
Simon
|
|
|
|
|
Can u tell me how to use Chart Control in C#.
|
|
|
|
|
You can get the docs here[^], and the samples here[^].
You need to learn yourself. If you get stuck come back and ask specific questions.
Simon
|
|
|
|
|
thank you Simon, i ll check it..
|
|
|
|
|
hi freinds
I need to call an stored procedure from c# code for ssis package, stored procedure has one output parameter
i have creaded one oledb command comonent using C# with this oledb command i want to execute the stored procedure
i have set the oledb command's sql command property like
DestErrorInst.SetComponentProperty("SqlCommand", "exec spInsertErrors ?, ?, ?, ? out");
now i want to map or read this output parameter values
how can i achieve this?
thanks
|
|
|
|
|
Hi all,
In my repeater control i have done a simple if condition as below
]]>
<%{ %>
<td>
Invoiced
</td>
<%}else{ %>
<td>
Not Invoiced
</td>
<%} %>
When i run this code i am getting a error as below
The name 'Container' does not exist in the current context
What is the reason for this error and how to solve this.
Please suggest me.
Thank you
Know is Drop, Unknown is Ocean
|
|
|
|
|
It is because you are asking in the wrong forum. Try ASP.NET.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
There are some issue around this answer
In My Example:
![CDATA[<%# for (int i = 0; i < System.IO.Directory.GetFiles(Server.MapPath(string.Format("~/Img/Att/{0}/", ((System.Data.Common.DbDataRecord)Container.DataItem)["ID"], "*.jpg"))).Length; i++)%><%{%><%= i %><%}%>]]>
I receive these errors:
Error 2 Invalid expression term ',' Destination.aspx 3 1
Error 3 Invalid expression term 'for' Destination.aspx 188 74
Error 4 The name 'i' does not exist in the current context Destination.aspx 188 244
Error 5 ; expected Destination.aspx 188
Error 6 ; expected Destination.aspx 188
Error 7 Invalid expression term ')' Destination.aspx 188
Error 8 ; expected Destination.aspx 188
Error 9 Invalid expression term ')' Destination.aspx 188
Do you have any idea ?
|
|
|
|
|
if I need to maximize picture box & list view as same as window form
how can i do?
please give hint or tip to me
thank so much...
|
|
|
|
|
If I got you right, you can set the control's Dock property to Fill.
You can also play with Anchor points to resize controls with the parent form.
Regards,
Lev
|
|
|
|
|
Hi ,
I want to change Startup object of Project at runtime. I want to use
VSLangProj.ProjectProperties namespace to set StartupObject Property of Project at run time. If anybody then please send me some hint.
Thanks
ab
|
|
|
|
|
Hi,
I want a code to capture the present GMT in C#.Net.
|
|
|
|
|
No
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
|
Windows API has 2 functions that returns time :
- GetLocalTime() returns the current local time.
- GetSystemTime() returns the UTC(GMT) time.
Cheers!!
Brij
|
|
|
|
|
i am using windows aplliction using c#...
i have 1000 records in my table....
which has fields CUSTOMER_ID,NAME,CITY,SALARY.....
I HAVE TO SEE ONLY THE CUSTOMER WHO ARE LIVING THE CITY CALLED "DOWNTOWN"
HOW CAN I SEE THIS IN DATAGRIDVIEW...
PLS REPLY...
GIVE ME SUGGESTION OR SAMPLE CODING...
THNX IN ADVANCE
|
|
|
|
|
on load of the screen or where ever you are loading the grid
just before binding to the dataGrid you can loop through each row and check the condtion where Rows[0].Cells[0].tostring()=="xyz"
vikas da
|
|
|
|
|
are you insane? I would hate to see crap like that in a program i have to maintain...
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|