|
Hi,
How can I add arrows like the ones that appear in DAP or IDM. Which says "Show Details" and contains an arrow that points downwards and when you click on it, it changes to "Hide Details" and the arrow points upwards... I hope my question is clear
There is no patch for ignorance
|
|
|
|
|
The test way is to change the text of the button on the click event. This way you can toggle between the texts ">>Detail" to "Detail<<". The other way is to change the image on the button
this.buttonTest.Image = (Image)TestIcons.GetIcon("ShowDetails.ico").ToBitmap();
Live Life King Size
Alomgir Miah
|
|
|
|
|
Alomgir Miah wrote: this.buttonTest.Image = (Image)TestIcons.GetIcon("ShowDetails.ico").ToBitmap();
Is 'TestIcons' an ImageList??
There is no patch for ignorance
|
|
|
|
|
Can anybody help me how can i uninstall a software pesent in the remote system?.thanks in advance
|
|
|
|
|
private void func1()
{
TP=1000000;
start_volumn=new double[TP];
pre_volumn=new double[TP];
post_volumn=new double[TP];
best_end_volumn=new double[TP];
}
For some reason, I need call function func1 many times. what will happen to the gabage collection system of C#? at the second time to run start_volumn=new double[TP]; will the memory allocated by the first time running start_volumn=new double[TP] by released?
THX
|
|
|
|
|
The memory will be collected when the garbage collector lazily collects. You can force a collection via GC.Collect(), however this is not recommended in typical situations.
|
|
|
|
|
That depends on the scope of the references you use. If you don't have references the previous arrays, the memory will be garbage collected when needed.
You should remove the reference (e.g. setting it to null) as soon as you don't need any of the arrays.
If the references may still point to old arrays when you enter the method, you'd better release those before you allocate the new arrays:
start_volumn = null;<br />
pre_volumn = null;<br />
post_volumn = null;<br />
best_end_volumn = null;<br />
start_volumn = new double[TP];<br />
pre_volumn = new double[TP];<br />
post_volumn = new double[TP];<br />
best_end_volumn = new double[TP];
This way the memory will be available for garbage collection if needed. If you don't do this, the reference will not be released until the new array is allocated and the new reference replaces the old.
If possible, you should consider reusing the same arrays instead of allocating new ones over and over.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote: If you don't do this, the reference will not be released until the new array is allocated and the new reference replaces the old.
But it is still up to the garbage collector to take back the memory. In an array like this it will instantly go into the third-generation heap when it was created, and so wouldn't be collected for a while anyway.
Maybe I'm spoilt. I work on server systems most of the time (6+Gb of RAM) so I never really worry about these things because I know that once it goes out of scope, with no other references, the garbage collector will get it when it needs to.
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
Yes, but the memory can't be taken back as long as there is a reference to the array. Compare these two codes:
ref = new double[5000];<br />
ref = null;<br />
ref = new double[1000];
Without releasing the reference:
ref = new double[5000];<br />
ref = new double[1000];<br />
---
b { font-weight: normal; }
|
|
|
|
|
Hence my second paragraph about being spoilt working on server systems with gargantuan amounts of memory.
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
Hi
I have a decimal value which i want to convert to string but it drops off .0 (decimal)
I can't format since whatever value in decimal I want it as it is in string
ex. 88.99 88.00 88.0 or just 88
Thanks
Thanks
|
|
|
|
|
double val = 88.00;
string valStringWithZeroes = string.Format("{0:0.00}", val);
You can see a list of string formatting options from this blog posting[^].
|
|
|
|
|
This is great but doesn't work if i have 88.0 it will format that to 88.00
I want which shows # as it is ... like 88.0 or 88888.888
Thanks
|
|
|
|
|
Your problem is that
double val = 88.0;
Is the same value as
double val = 88.0000;
They're the same in the real mathematical sense of decimal values, as well as the same in the CLR. So, there's no way for you to print out whether it's 88.0 or 88.0000 if you're storing it as a double. I'm not sure whether there's a type in the CLR that stores an arbitrary number of decimal places as part of the value type itself.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Connor's Christmas Spectacular!
Judah Himango
|
|
|
|
|
Judah Himango wrote: They're the same in the real mathematical sense of decimal values, as well as the same in the CLR. So, there's no way for you to print out whether it's 88.0 or 88.0000 if you're storing it as a double. I'm not sure whether there's a type in the CLR that stores an arbitrary number of decimal places as part of the value type itself.
For something not being modifed in code, String.
If you need to use it arithmatically, I'd suggest looking at scientific libraries for a class that handles significant figures, because with SF 88.1 != 88.10. The former represents the range 88.05
|
|
|
|
|
dan neely wrote: SF 88.1 != 88.10
I knew someone would call me out on this. It all depends on the context really; if we're talking about precision, yes, they are obviously not the same. If we're talking about simple arithmetic, they are the same value if precision is ignored (which is often the case in arithmetic). Anyways...for his uses, he'll need to either get a scientific library or write a type that preserves decimal precision, so it seems. I can't find any type in the CLR that preserves decimal precision.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Connor's Christmas Spectacular!
Judah Himango
|
|
|
|
|
I know 88 is same as 88.0 or 88.00 but according to my requriments i have two #'s coming in ex 00.00 as string aand 88.00 as decimal .... now i have to compare string # to decimal which means that my number should have 2 digit before decimal and 2 digit after
another example one # is 0.0 measn another # should have one digit before decimal and one digit after decimal ... regardless of 8.0 is same as 8.00 or 8 ... in my case only 8.0 or 8.1 0r 8.2 or 9.1 are the valid digit since one digit after decimal and one digit before decimal
That's why i can't use formating since i don't what's the 1st # will look like which is string and what's the 2nd # looks like which is decimal
Thanks
|
|
|
|
|
Judah Himango wrote: dan neely wrote:
SF 88.1 != 88.10
I knew someone would call me out on this. It all depends on the context really; if we're talking about precision, yes, they are obviously not the same.
true. I mainly included it since I wasn't sure what the OP wanted, and wanted to epxlain why the class was doing what it was and check for potential side effects instead of assuming it was a 'double but keeps empty decimal places' and then getting burned over it enforcing SF, or the like.
|
|
|
|
|
The problem is that there is no single format that will achieve your goal
Say you have 88.0 and 88888.888
Console.WriteLine("{0 ##}", num)
will give you
88.0
88888.888
the problem is that if you have another number of finer precision, say 99.1234, it will be rounded to 99.124.
If you use the general format g
Console.WriteLine("{0:g}", num)
then you will get
88
88888.888
99.1234
If you have a hard need to display 88 as 88.0 then you will probably need to use two format strings
Dim nums() As Double = {88, 88888.888}
Dim numFmt As String
For Each num As Double In nums
Dim tmpNum As Double = System.Math.Abs(num)
If (System.Math.Floor(tmpNum) = tmpNum) Then
numFmt = "#.0"
Else
numFmt = "g"
End If
Dim exprFmt As String = "{0:" & numFmt & "}"
Console.WriteLine(exprFmt)
Console.WriteLine(String.Format(exprFmt, num))
Next
End Sub
NOTE: When testing this, it works well for Doubles but not singles. Don't know why
hth,
Alan.
if (
|
|
|
|
|
Well! Dears.
i have an mdi form in which i open differnet child forms . when both parent and child are maximized its ok but when i restore the MDI parent form it disturbs the layout of Child form that was Maximized in MDI. What i want is that when i restore MDI form it doesnt disturb the layout design of Child form instead it (MDI form) gets Horizantal and vertical scroll bar keeping the Child Form Maximized and undisturbed. How to do that.
Thnx in Advance.
|
|
|
|
|
If you're asking how to automatically get scrollbars to some control, look at System.Windows.Forms.ScrollableControl. When some control added to a ScrollableControl extends beyond the visible portion of the ScrollableControl, scrollbars will automatically appear.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Connor's Christmas Spectacular!
Judah Himango
|
|
|
|
|
hi !
I want to save the value of date with the using DateTimePicker Control in a sql table with the date Format .
...<br />
try{<br />
strSQL ="update mytable set name='"+txtName.Text+ "',mydate='"+DateTimePicker1.???? ......
Any guid is very appereciated.
Regards
s_mostafa_h
-- modified at 9:30 Wednesday 22nd February, 2006
|
|
|
|
|
string commandText = "UPDATE mytable SET name = @name, mydate = @date";
SqlCommand command = new SqlCommand(commandText, myConnection);
command.Parameters.Add(new SqlParameter("@name", txtName.Text));
command.Parameters.Add(new SqlParameter("@date", dateTimePicker1.Value));
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Connor's Christmas Spectacular!
Judah Himango
|
|
|
|
|
I Wrote this :
try{<br />
strSQL ="update mytable set name='"+txtName.Text+ "',mydate='"+DateTimePicker1.Value+"'";<br />
cnSQL = new SqlConnection(Connectionstring);<br />
cnSQL.Open();<br />
cmSQL = new SqlCommand(strSQL, cnSQL);<br />
cmSQL.ExecuteNonQuery();<br />
cnSQL.Close();<br />
cmSQL.Dispose();<br />
cnSQL.Dispose();<br />
} <br />
catch(SqlException e)<br />
{<br />
MessageBox.Show(e.Message, "Error");<br />
} But I have this Error :
syntax error converting datetime from character string
the type of mydate field is datetime .
please guide me !
thanks
s_mostafa_h
|
|
|
|
|
mostafa_h wrote: strSQL ="update mytable set name='"+txtName.Text+ "',mydate='"+DateTimePicker1.Value+"'";
Don't do that. You're opening yourself up to SQL injection attacks[^]. I showed you the proper way to do it in my last reply (by using SqlParameter objects). If you follow that course of action, you won't get the error.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Connor's Christmas Spectacular!
Judah Himango
|
|
|
|