|
Actually I think boldness of the date is particular property of the cell (where the user click), and I want to check that property of selected date cell (is it bold or not). Otherwise traversing in whole array will be very lengthy process. So can we check it?
|
|
|
|
|
AFAIK you can't check it and need to work with the array returned by the BoldedDates property.
www.troschuetz.de
|
|
|
|
|
|
Hello all,
I bind a combobox with datasours but i need to display the first selection blank how can do that.
Regards,
Haytham
|
|
|
|
|
Hello,
You could just put a empty item in your Combobox.Items Collection. Assuming you are using String objets, the empty String would do this just fine
Hugo Migneron
|
|
|
|
|
hi, i'm looking for part time, freelance, contract type projects in C#
to do in my spare time. where is the best place to go to find this
type of work? thx!
mike
|
|
|
|
|
hi, i'm looking for part time, freelance, contract type projects in C#
to do in my spare time. where is the best place to go to find this
type of work? thx!
mike
|
|
|
|
|
Is there an easy way to prevent a child Control from getting the focus? Meaning if I have a component, then I add a label, but I am testing the MouseEnter/MouseLeave event on the parent, it will fire when the mouse goes over the Label.
|
|
|
|
|
Hi
I have a datgrid and when I click the toolbar or menu which has a
save action, the last change is ignored. But if its a normal Button
everything works fine. Is there anyway to force the datagrid to save
the current record?
I tried CurrencyManager and EditCurrentEdit() but no luck.
Thanks
Alomgir
|
|
|
|
|
Hello, Friends,
// this is a piece of code from the book "Program Windows Form in C#"
// it uses keyword "using"
protected override void OnPaint(PaintEventArgs pe) {
Graphics g = pe.Graphics;
// after this , foreBush is disposed, so , how can it be used
// in the next statement.
// surprisingly. it works.
using( Brush foreBrush = new SolidBrush(this.ForeColor) )
using( Brush backBrush = new SolidBrush(this.BackColor) ) {
g.FillEllipse(foreBrush, this.ClientRectangle);
...
}
// Calling the base class OnPaint
base.OnPaint(pe);
}
|
|
|
|
|
It's disposed after all the statements in the using clause is executed.
|
|
|
|
|
// look at this:
using( Brush foreBrush = new SolidBrush(this.ForeColor) )
// here foreBrush is disposed eh?? how come it can still be used?
using( Brush backBrush = new SolidBrush(this.BackColor) )
|
|
|
|
|
The using statement is translated by the compiler from
using(Brush foreBrush = new SolidBrush(this.ForeColor))
{
...
}
to
Brush foreBrush = null;
try
{
foreBrush = new SolidBrush(this.ForeColor);
...
}
finally
{
if (foreBrush != null)
((IDisposable)foreBrush).Dispose();
}
foreBrush gets disposed in the finally block. Because you are using it within the block, it works. Your code will get translated into something like
Brush foreBrush = null;
try
{
foreBrush = new SolidBrush(this.ForeColor);
Brush backBrush = null;
try
{
backBrush = new SolidBrush(this.BackColor);
...
}
finally
{
if (backBrush != null)
((IDisposable)backBrush).Dispose();
}
}
finally
{
if (foreBrush != null)
((IDisposable)foreBrush).Dispose();
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
S. Senthil Kumar wrote:
Brush foreBrush = null;
try
{
foreBrush = new SolidBrush(this.ForeColor);
...
}
finally
{
if (foreBrush != null)
((IDisposable)foreBrush).Dispose();
}
which begs a question, what if foreBush does not implement IDisposable ? It will simply crash ( throw exception) ?
David
|
|
|
|
|
Hence why only those objects which implement IDisposible can be used within a using block.
In this case foreBrush is an instance of SolidBrush and that implements IDisposible
|
|
|
|
|
I know. I just thought that it could be like
finally
{
IDisposable thing;
if ((thing = foreBrush as IDisposable) != null)
thing.Dispose();
}
OK, it's better how it is.
David
|
|
|
|
|
The code wouldn't compile if Brush didn't implement IDisposable. The compiler would complain that the type used in the "using" statement cannot be disposed, or something similar to that. So there's no question of a runtime crash.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
S. Senthil Kumar wrote:
The code wouldn't compile
That's exactly the answer I was looking for. Thanks.
David
|
|
|
|
|
Hi , Senthil , does that mean, after foreBrush is disposed, if following code gona use it , then it will be constucted again ??
|
|
|
|
|
No, it means that foreBrush will be disposed only at the end of its block. So
using (Brush foreBrush = new Brush())
using (Brush backBrush = new Brush())
{
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
there is no ";" after the using( Brush foreBrush = new SolidBrush(this.ForeColor) ) .
it behaves like the if clause. you can use it like this:
if (x == true)
if (y==true)
{
... code in block ...
}
or like this:
if (x == true)
{
if (y==true)
{
... code in block ...
}
}
if there would be a semicolon right after the using statement your assumption that the foreBrush should be disposed would be true.
/cadi
|
|
|
|
|
How can I execute some command from my C# programm, as though I execute it from cmd.exe?
And how can I get the result of it?
So, I need execute "net view \\hostname" and get its output into a string variable..
Help, please..
--
Digitally yours, Bounz
|
|
|
|
|
Look at the System.Diagnostics.Process class. You can start a process and intercept its output to your own stream. You pass the name of the app into a ProcessStartInfo object just like you would pass the name of the app in the command window.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: The Secular Left, the Religious Right, and Prejudice
Judah Himango
|
|
|
|
|
thanks, I'll try
--
Digitally yours, Bounz
|
|
|
|
|
hi ,
in my application i have so many file . and i have to make these files as Gzip file . is there anyone can help me by sending me the source code .
How to GZip many files including files ...
i use ICSharpCode.SharpZipLib.GZip;
Thanks
|
|
|
|