|
The query string is SQL syntax not C# syntax, so sColName IS NOT NULL should do the trick.
|
|
|
|
|
How do I make my status bar functional in C#.net 2005 e.g dividing into panes, displaying info based on current action of the app.
Banjo Ayorinde
|
|
|
|
|
Write a javscript for it
function callFunction()
{
window.status="Come On i am here";
}
call this function in html body load to see your text in status bar
<l>Thanks and Regards
Sandeep
|
|
|
|
|
In all my applications, every time i used something like a FileStream, when i finished using it i called:
<br />
fs.Flush();<br />
fs.Dispose();<br />
fs.Close();<br />
I'm wondering, what's the difference between flushing and disposing or just closing? what's the most efficient way of doing it?
|
|
|
|
|
|
OK
FileStream reads the content in bytes
fs.Flush()-> method clears the buffer which is used by fs while reading or writing
fs.Dispose()-> make the object ready for Garbage collection no instance in Memory
fs.close()-> Only close the fileStream without doing anything
<l>Thanks and Regards
Sandeep
|
|
|
|
|
well, then, i can use dispose instead of flush and close? or flush and dispose without close? o_O
|
|
|
|
|
Its good practice to flush the buffer before closing the stream
after closing the you can call dispose method .
while writing if you forget to call close then it will not save the file which you are manupilating
<l>Thanks and Regards
Sandeep
|
|
|
|
|
no, you can't dispose after you close...you have to dispose before (if you dispose after you close it throws an exception)
|
|
|
|
|
Sorry you are write
Calling Dispose allows the resources used by the Stream to be reallocated for other purposes.
Flushing the stream will not flush its underlying encoder unless you explicitly call an implementation of Flush or Close. Setting AutoFlush to true means that data will be flushed from the buffer to the stream, but the encoder state will not be flushed. This allows the encoder to keep its state (partial characters) so that it can encode the next block of characters correctly.
Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream
Taken from MSDN
<l>Thanks and Regards
Sandeep
|
|
|
|
|
sharpiesharpie wrote: if you dispose after you close it throws an exception
If it does, it's a bug in the implementation. You should be able to call Dispose any number of times, and if the object already has been disposed, it should ignore it.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi,
IMHO:
Flush() is meaningful only if you dont plan on closing right away; it means "send this
through, before I produce more".
I use Flush() when tracing a program's progress to a file, so when the program suddenly
crashes, the file contains all traces including the very last that was called.
FileStream.Dispose():
on .NET 1.1 only exists as Dispose(bool) and is protected, you cant call it;
you should call Dispose() for each object that offers a public Dispose(), but you cant
call a protected one (unless you are inheriting from the class).
on .NET 2.0 exists and is public but the doc says "is not intended to be used directly
from your code", so dont call it !
Close() is the one that MUST be called, it tells everything is done. And according to
the doc it calls Dispose(bool) itself.
Conclusion:
call either Flush() if you plan on producing more but want to make sure what you already
have gets processed, or Close() if you're done. Dont call both.
BTW looking at the (current) implementation is not a sound base for deciding what
function to call, reading the doc is.
|
|
|
|
|
sharpiesharpie wrote: fs.Dispose();
fs.Close();
Close and Dispose in this class are synonyms of each other - they do the same thing.
As implemented, Close() calls Dispose() which, in turn, calls Flush()
Flush writes out anything remaining in the buffer to the file.
|
|
|
|
|
Colin Angus Mackay wrote: As implemented, Close() calls Dispose() which, in turn, calls Flush()
Actually, they don't call Flush . I just double-checed that through Reflector. The call order is backwards as well: Dispose does call Close , which then calls a protected Dispose(bool) method which actually does all of the work.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Scott Dorman wrote: I just double-checed that through Reflector
Ummm... I got my information through reflector.
Dispose calls close on an object of a class called __HandleProtector , not FileStream .
public override void Close()
{
this.Dispose(true);
GC.nativeSuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (this._handleProtector != null)
{
if (!this._handleProtector.IsClosed)
{
this.Flush();
}
this._handleProtector.Close();
}
this._canRead = false;
this._canWrite = false;
this._canSeek = false;
this._buffer = null;
}
public override void Flush()
{
if (this._handleProtector.IsClosed)
{
__Error.FileNotOpen();
}
if (this._writePos > 0)
{
this.FlushWrite();
}
else if ((this._readPos < this._readLen) && this.CanSeek)
{
this.FlushRead();
}
}
|
|
|
|
|
err...so...what's the best way to do it? flush + close?
and...how can i see the objects and classes? (the premade ones), the object browser right?
|
|
|
|
|
sharpiesharpie wrote: err...so...what's the best way to do it? flush + close?
Since closing and disposing both get around to flushing the stream, why bother flushing it yourself?
|
|
|
|
|
We are looking at two different versions of the Framework. What you show is correct for .NET 1.1. For .NET 2.0 and later, the implementation is what I described. Here are the full details:
Since FileStream inherits the Close() and Dispose() methods from Stream , reflector shows the following for Stream :
public virtual void Close()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}
public void Dispose()
{
this.Close();
}
protected virtual void Dispose(bool disposing)
{
if (disposing && (this._asyncActiveEvent != null))
{
this._CloseAsyncActiveEvent(Interlocked.Decrement(ref this._asyncActiveCount));
}
} Since Flush() is an abstract method, the FileStream class implements it as:
public override void Flush()
{
if (this._handle.IsClosed)
{
__Error.FileNotOpen();
}
if (this._writePos > 0)
{
this.FlushWrite(false);
}
else if ((this._readPos < this._readLen) && this.CanSeek)
{
this.FlushRead();
}
}
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Dispose and Close are equivalent, so you can call either one (or both).
Flush will write the contents in memory to the file (the stream's backing store).
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
I need the procedure on how and when to use (add) the crystal report "product key" during deployment of crystal report application (.Net 2005), since it is requied to validate the licence of the crystal report windows app.
Banjo Ayorinde
|
|
|
|
|
Hy
A class who create a MyTextBox and have a constructor who create a new TextBox.
I need to make a propertyGrid with the property of the MyTextBox (e.g. left,top,width,height), but in the propertygrid i see the properties of the MyTextBox and the properties of the TextBox.
How can I do to hide the properties of the TextBox and show only the property of the MyTextBox.
10x
|
|
|
|
|
hi,
i did it some other way (by inheratance... and overrides the properties of tha bease class... the ones i didn't want to see were marked with
[Browsable(false)]
before the methode...
if yourtextbox is a property or public variable, i guess you can use this also...
greetz
kurt
|
|
|
|
|
10x ... working.
But other is the problem
MyTextBox inherit a class MTextBox who have a TextBox mtb = new TextBox(); and a property Mtb
and when I create MyTextBox myTB = new MyTextBox(); and put it into the propertyGrid the myTB, I can see the Mtb property who have the exact property of an TextBox object.
I want to not see the Mtb in my propertyGrid ... and I tried with [Browsable(false)] and it isn't work.
Do u think it's another solution?
10x
|
|
|
|
|
verify....
so you placed this code into your MTextBox class ?
private textBox mtb;
[Browsable(false)]
public textBox Mtb
{
get { return mtb;}
set { mtb = value;}
}
that should work..
Not sure but otherwise override the methode in your MyTextBox class and do the same...
|
|
|
|
|
This is the base class:
public abstract class MgrComponentBase
{
Control _baseControl = new Control();
[Browsable(false)]
public Control BaseControl
{
get { return _baseControl; }
set { _baseControl = value; }
}
[CategoryAttribute("Properties"), DescriptionAttribute("Something")]
public string ComponentName
{
get { return BaseControl.Name; }
set { BaseControl.Name = value; }
}
...
This is the second Class:
public class MgrTextBox : MgrComponentBase
{
string _label;
string _tooltipText;
[Browsable(false)]
public MgrTextBox()
{
BaseControl = new System.Windows.Forms.TextBox();
}
public System.Drawing.Color BackgroundColor
{
get { return BaseControl.BackColor; }
set { BaseControl.BackColor = value; }
}
public System.Windows.Forms.TextBox TextBox
{
get { return (TextBox)BaseControl; }
set { BaseControl = value; }
}
...
and doesn't work.
|
|
|
|