|
how to export Windows Registry information to .REG file using c#.net?
thanks in advance
|
|
|
|
|
You can write a bat file which export registry to reg file and call it from your program. Or you can just call reg.exe from your program directly.
|
|
|
|
|
For example I create a string variable as follows:
string strNumber = "123";
To convert it into integer data type which is better option and whats the differnce between these options.
a) Convert.ToInt32(strNumber);
b) int.Parse(strNumber);
Software Development & Web Development is my addiction. I am a Visual C# 2.0 and ASP.NET 2.0 Developer and working in Visual Studio 2005 using Dot Net Framework 2.0.
Email: bottomless.wisdom@hotmail.com
Web: http://bottomless-wisdom.spaces.live.com
modified on Monday, December 8, 2008 2:23 PM
|
|
|
|
|
Hi,
The documentation is your friend!
The docs for Convert.ToInt32(string) state:
The return value is the result of invoking the Int32.Parse method on value.
AlanN
|
|
|
|
|
Like Alan says - No difference.
The best option for converting from string to int though is the Int.TryParse() method. It returns false if the parse failed rather than throwing an exception like the other ways do.
Simon
|
|
|
|
|
More often than not, I've found that I need the exception thrown if only to avoid executing code that cannot proceed without a valid conversion.
I guess that means that you use the technique that best fits the situation/requirements.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
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.
|
|
|
|