|
How can I serialize System.Web.UI.WebControls.Unit class?
I have web control's properties stored in session and I need them serializable. Any suggestions?
|
|
|
|
|
You can either use an ISerializationSurrogate along with your serialization formatter, or have the parent serialize and deserialize he struct's members and don't serialize the struct itself.
How are you serializating this? That might help answer your question a little better.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Ok with the help of this list I am getting somewhere with interfaces... But I have a little trouble with the C#/.NET reference documentation.
My question
What does the Type.GetInterface Method return if the type does not have the requested interface. The .NET documentation does not specify this in the methods documentation?
Thanks for helping
I am a bit green to this environment but I am getting there quickly with this site/list.
|
|
|
|
|
Return Value
A Type object representing the interface with the specified name, implemented or inherited by the current Type, if found; otherwise, a null reference (Nothing in Visual Basic).
...straight form the Type.GetInterface documentation. As a norm, methods that return reference types typically return null in cases like this, or just throw an exception if there's an error.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi,
How can I clean the console in a C# console application ?
(juste like the cls dos command).
Regards,
Matthieu
|
|
|
|
|
Yep, Microsoft haven't included one method to do this on the Console class,
you can find some Console extended clas if you search, i don't try that.
Luck!
----------------------------------------------------
Q no seas un paranoico no quiere decir q nadie no te persiga
|
|
|
|
|
I want to extend then .net framewok's usercontrol,to make it has a showdialog like windows forms. How Can i get it???
Thanks a lot!!
|
|
|
|
|
Just like you would do it when not working on an UserControl :
MainForm frm = new MainForm();
frm.ShowDialog(this);
|
|
|
|
|
Hi! I think you maybe mistake what i said! I mean the UserControl has the ShowDialog() method acts as the showdialog() method of the window forms. For example,there is a userControl instance: "usercontrol1",When I click a button,I call The usercontrol1's method usercontrol1.Showdialog(),and the usercontrol1 will be showed just like we show a Form instance with then showdialog() method.
|
|
|
|
|
Even I'm confused(not unusal). You want usercontrol1 to call showdialog on itself What's the point?
|
|
|
|
|
A control can't show itself as a dialog. This comes down to Windows styles and messages, since the System.Windows.Forms controls are just wrappers for native controls (Common Controls).
You could add a ShowDialog method that adds the control to a borderless form and shows the form, but you can't show the control itself. It just isn't possible - it needs a Windows frame to host it.
So you could do something like this:
public void ShowDialog()
{
Form f = new Form();
f.FormBorderStyle = FormBorderStyle.None;
f.Size = this.Size;
f.Controls.Add(this);
f.ShowInTaskbar = false;
f.ShowDialog();
f.Dispose();
}
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi Heath
I have been trying this method to get access to the UITypeEditors, but I keep on gettting SEHExceptions, any ideas?
Cheers
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
Not really. The description, "Represents Structured Exception Handler (SEH) errors.", doesn't even help much. I take it you're talking about the UITypeEditor s like the ColorEditor (or whatever that nifty one is) that are internal to the .NET BCL? Or just to host your own in a control?
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Heath Stewart wrote:
I take it you're talking about the UITypeEditors like the ColorEditor (or whatever that nifty one is) that are internal to the .NET BCL? Or just to host your own in a control?
Well both, so I can use an existing infrastructure. And reuse my custom editors in the propertygrid again. Have a look at the nightmare of the propertygrid thru a disassembler. Things just dont make sense anymore. Like the "dropdownui" is a control hosted in a form hosted in a control. I mean crazy, and funny unsafe calls... maybe they made it intentionally like that!
Also things like: TypeConvertor.EditValue() returns immediately, so u to somehow block it, without having access to the code, i say man, its a nitemare (R18)
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
|
If you just want to show or hide a UserControl , than you can use one of the following:- Call
Show [^] to show the control, and Hide [^] to hide it again. - Set
Visible [^] to true to show the control, and to false to hide it again.
If you want to do something else, then please clarify it.
- Daniël Pelsmaeker
This is Linux country. On a quiet night, you can hear NT re-boot.
|
|
|
|
|
I want to know the complete information of a Database...
how many tables it have what r there manes...
each table have how many attributes and what r there names......
and want to show it in a treeview...like this
TreeView1.Nodes(0).Nodes.Add(snode)
using OleDbConnection
i execute query like this
select * from emp
Table.Columns.Count
Table.Columns.Item(count).ToString
through this i came to know the column number and name
but want to know full information about a database.....
Nothing ...........................................................
|
|
|
|
|
ADO.NET is a set of abstract classes. It isn't meant to provide you with everything, nor is the rest of the .NET Framework for that matter. If the database you're querying supports schema information queries, you can use that information (SQL Server does, see the SCHEMA_INFORMATION tables you can query, but in that case you'd be better off using the System.Data.SqlClient namespace for better optimizations for SQL Server).
If the database doesn't support schema information, you'll probably have to start P/Invoking a lot of the old ADO calls (note, that's not ADO.NET, just ADO). Because that, too, is an abstract API (though not quite as abstract), it might not get you everything you want to know either. Many times, though, the OLE DB provider can get you that stuff, but it is usually specific to the OLE DB provider, not to ADO itself.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
i didnt get the point pzl tell me the more speacific....
Nothing ...........................................................
|
|
|
|
|
There's far too much to cover in a forum thread. I gave you several pointers; you'll have to research this if you want to do it. Research is an all-too-important part of R&D.
There's plenty of information about ADO and various OLE DB drivers in the
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi
I wish to assign icons to the various buttons in my application by referencing them from an icon library in which they are present. Please let me know how i can do that.
Thanks in advance
Regs
Sam
|
|
|
|
|
I just want to mention about one way doing this.
You can create a resource dll and embed your resources to this dll choosing the Build Action as Embedded Resource.
Then you can reach this icons as librray items.
Imagine yo have the icon test.ico in IconLibrary namespace and you want to change your form's icon.
System.IO.Stream st=assemblyExecuting.GetManifestResourceStream("IconLibrary.test.ico");
form.Icon=new System.Drawing.Icon(st);
System.IO.Stream st=assemblyExecuting.GetManifestResourceStream("IconLibrary.test.ico");
Read the icon as stream
form.Icon=new System.Drawing.Icon(st);
Then set the form's icon. Yo can also use System.Drawing.Bitmap(st) to convert the image to the bitmap.
Once you can get the image from the assembly you can use it in everywhere.
I Hope it helps
|
|
|
|
|
There's also a shortcut using the right Icon constructor, Icon(Type, string) . Like many other constructors (including many attribute constructors), the Type parameter is a type used for resource resolution. For instance, building on your example, lets say that you also had a class in the IconLibrary namespace. Specifying that Type plus "test.ico" in the constructor will cause the CLR to use that Type's namespace and append the resource name. This works a lot like relative paths in relation to directories on a filesystem or in a URL.
So, the same thing would work with less code (and amounts to the same thing):
Icon i = new Icon(typeof(IconLibrary.SomeClass), "test.ico");
form.Icon = i;
Of course, this only works if you have a Type you can reference in that namespace, but I thought I'd mention it because a lot of libraries keep these in the same directories as their respective controls (though not all). In those cases, using this approach is a little easier.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Many thanks....
You code and explaination is most helpful..i will try it out.
Regards
Sam
|
|
|
|
|
Hi all,
I'm having a stupid question, how can I get the integer that represent the enum?
public enum outputType
{
TIF = 0,
JPG,
BMP,
none
}
I would like to get the integer of this enum, somethings like
int num = (int)outputType.JPG;
how can I do it?
Thank you
|
|
|
|