|
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.
|
|
|
|
|
this one is not neccessary for the constructor..
[Browsable(false)]
public MgrTextBox()
{
BaseControl = new System.Windows.Forms.TextBox();
}
what if youset the propertygrid to the MgrComponentBase
class??
i think overriding the BaseControl property in the MgrTextBox class should help you..
[Browsable(false)]
public override Control BaseControl
or
[Browsable(false)]
public new Control BaseControl
{
get { return base.baseControl; }
set { base.baseControl = value; }
}
|
|
|
|
|
Hi,
I have loaded a dataset with a table that contains 1000 records. so far so good.
When loaded i assign my Datagridview.Datasource event with the table, but this takes 4 seconds before i actualy see the records in my grid.
DgvCardHolders.DataSource = DsCardHolders.Tables[0];
Does someone have an idea how to show the progress of this load ?
i suppose the datagridview is copying the data from the datatable.
Thx
Kurt
|
|
|
|
|
Okay,
here i am again....
2 posibilities...
THE PROBLEM :
The property AutosizecolumnsMode was set to Allcells and that's whats making it slow.. so i set it to Alldisplayedcells and guess, no performance problem at all.... over 3000 records in no time on screen.. (so don't tell me delphi is faster now...no way.. just do it the right way.)
STILL WANTS A PROGRESS BAR :
If u still want to use AllCells and show a progress bar a solution is using virtualmode. Switch the property on and use the cellvalueneeded event to fill in the grid values.. in this event you can calculate the progress using the e.index and the row.count and show it on screen while loading. Don't use the Datasource property in this case.
Greetz
Kurt
Belgium.
|
|
|
|
|
Hello, I have a control, that creates a dialog using ShowDialog() method of a Form class. The problem is that sometimes it happens, that another application shows instead of the created dialog. I have tried passing null as an active window should be used. Tried passing the control, that creates the dialog, but no better, the window dissappears. Now I'm just experimenting with BringToFront(), Activate(), but no luck.
Any help would be appreciated, thanks a lot for your time ...
|
|
|
|
|
Maybe settings your own application topmost at that moment ???
your application and your dialog will remain on top of all other windows..
otherwise search for main windowhandles of other apps and hide them by a windowsmessage, but thats a lot of work i guess...
greetz
|
|
|
|
|
Hi
I have written an application in which on left side there are oulook style menu.When i click anyone from that menu a new child form open in panel control of parent form.
My problem is that this child form is not getting focus .i HAVE ALSO TRIED .FOCUS AND .SELECT methods.
if i donot add this child form in panel control then form gets focus but on maximizing child form it also covers the area of left created menus.
So how i can get focus on child form in panel control ? or how i restrict child form not extend from specified left position on maximization.
I am using Visual Studio 2005 c# windows form
|
|
|
|
|
myChildForm.Activate();
Geniality is in simplicity.
|
|
|
|
|
Yes i tried this one also but child form not getting focus in panel
|
|
|
|
|
Also note that if there is text box on child form and in this scnerio if you click text box you can type text in it but cannot select the text in textbox by simply mouse selection(draging mouse).
|
|
|
|
|
I'm trying to write a dll in C#, but when I try to register it with regsvr32 I get the error message: "xyz.dll was loaded but dllregisterserver entry point was not found"
Thanks for any help
|
|
|
|
|
Into AssemblyInfo.cs ( or elsewhere put this piece of code ).
[assembly: ComVisible(true)]<br />
<br />
[assembly: Guid("b8e616b6-9213-4103-af65-8965422566b3")]
Geniality is in simplicity.
|
|
|
|
|
this is already done, but still isn't working
|
|
|
|
|
Are you sure, the "ComVisible" attribute are set on "true"? Default value is "false".
Maybe, this KB will help you: http://support.microsoft.com/?scid=kb%3Ben-us%3B249873&x=11&y=9
Geniality is in simplicity.
|
|
|
|
|
This is the code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Management;
using System.Runtime.InteropServices;
namespace register
{
public interface reg_inter
{
string procId();
}
[ComVisible(true)]
public class reg:reg_inter
{
public reg()
{
}
public string procId()
{
ManagementObjectSearcher search =
new ManagementObjectSearcher("select * from win32_processor");
foreach (ManagementObject wmi in search.Get())
{
PropertyDataCollection prC = wmi.Properties;
foreach (PropertyData pr in prC)
{
if (pr.Name == "ProcessorId")
{
return pr.Value.ToString();
}
}
}
return "0";
}
}
}
and this is assemblyinfo.cs:
.
.
.
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(true)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3ea648c1-75cf-4d96-9978-d615378e027c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Where am I wrong?
|
|
|
|
|
OleDbConnection connect=new OleDbConnection();
connect.ConnectionString="Provider=DB2OLEDB; initial catalog=SAMPLE;integrated security=SSPI,user id=db2admin;password=eugene09";
connect.Open();
OleDbCommand cmd_save =new OleDbCommand("INSERT INTO test(name,year,course)"+"VALUES("+"'"+textBox1.Text+"'"+","+"'"+textBox2.Text+"'"+","+"'"+textBox3.Text+"'"+")",connect);
int intRow=cmd_save.ExecuteNonQuery();
if(intRow>0)
{
MessageBox.Show("Record added");
}
connect.Close();
this is a program i created adding a record in the database but their is no error but an exception, saying " DB2OLEDB is not existing in the local machine."
i think the problem is in the insert command. thanks for all the help!
|
|
|
|
|
icesha wrote: an exception, saying " DB2OLEDB is not existing in the local machine."
i think the problem is in the insert command. thanks for all the help!
The error message (incorrectly copied as it is) suggests the connection in the source of the problem. Have you installed DB2 on your local machine?
|
|
|
|
|
How to create a simple alarm application in C#..
|
|
|
|