|
The console does not have the concept of a message queue, so it doesn't really handle events - the only event it publishes is CancelKeyPress[^]
However, there is a way to do more. See this article: Console Event Handling[^]
Be warned though - it's not for beginners!
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Thanks for that respectable and most helpful link, Sir Griff.
|
|
|
|
|
|
hi all. I'm new to serialization and i cant understand something.
i read this article:
Introducing Serialization in .NET[^]
when do i need to use theSerializationAttribute , meaning when do i need to write [Serializable] above a class ?
i found an example for XmlSerializer and no [Serializable] tag was needed to serialize and DE-serialize all the classes there.
another thing i cant understand or find any doucimentation is HOW serilization really works. how is the magic of object to strean and vice versa works.
can any one give an hand to a fellow programmer ?
thx
|
|
|
|
|
This attribute marks types as serialisable through the standard serialisation process (using a BinaryFormatter or SoapFormatter). Despite its similar appearance, the XmlSerializer uses a different pathway, and the [Serializable] attribute has no effect there (instead, use [XmlSerializable]).
Standard ([Serializable]) serialisation stores the complete internal state of the object, by serialising private fields. To be able to use it, every field within the type must itself be serialisable (either by being a CLR type or itself being marked as [Serialiazable]), because the complete state must be available to the serialiser. There is an exception to this, if you explicitly mark some fields as [NonSerializable]. In contrast, the XML serialisation can only be applied to public properties, and you need to reconstruct the internal state of the object to an equivalent state based on the value of those properties.
You should use [Serializable] and IFormatters when you want to save or transfer a complete dump of an object, and reconstruct it exactly as it was before. For example, classes which are to be passed across AppDomain or web service boundaries need to either be marshalled by reference or serialisable. You should use XML serialisation and [XmlSerializable] if you want to use XML to save or transfer a high level view of an object, and you can use the public properties to sufficiently reconstruct the target object.
The article you linked to is quite good and once you understand that the XML serialiser is a separate thing, hopefully it will help you.
|
|
|
|
|
I have a Windows.Forms.ListView control. On this control I need to have 310 columns. While scrolling through the listview the first 245 display without problems. After that, the column headers stop scrolling, but the data continues to scroll. Is there a setting somewhere for the max number of column headers that are allowed? Any idea what might be causing this?
Thank you.
Kalvin
- Kalvin
|
|
|
|
|
I've learned a little more about what is going on with this. It isn't a problem with the number of columns, but the total width of all the columns. If I give each column a width of 140 then I have a problem scrolling. If I give each column a width of only 100 with 310 columns then there is no problem.
listView1.View = View.Details;
listView1.MultiSelect = false;
listView1.FullRowSelect = true;
listView1.HideSelection = false;
for (int i = 0; i < 310; i++)
{
listView1.Columns.Add((i-1).ToString(), 140);
}
ListViewItem itm = listView1.Items.Add("newRow");
foreach (ColumnHeader columnHeader in listView1.Columns)
{
itm.SubItems.Add(columnHeader.Index.ToString());
}
- Kalvin
|
|
|
|
|
32768 / 140 is ~234...looks like exceeding 32768 pixels IS a bad idea[^]
Mark Salsbery
|
|
|
|
|
The docs[^] state "Unexpected behavior can result when the combined width of all columns exceeds 32,768 pixels." Could that be an issue?
Mark Salsbery
|
|
|
|
|
Mark Salsbery wrote: Could that be an issue?
Nope. It could be a paradox: when warned like that, there no longer is anything not to expect.
|
|
|
|
|
Your specific problem has been identified, however I would suggest you have a greater problem in the design of the UI part of your application.
I cannot imagine any scenario where it would be useful to any user that so many columns are displayed. Better to provide a means for the user to select to dispay differing subsets of the data so they can view what is relevant easily than to swamp them with so much data that requires endless scrolling IMO.
|
|
|
|
|
Very true. I mean displaying hundres of columns is just insane IMHO.
All the best,
Dan
|
|
|
|
|
Why would you want to display 310 columns?
|
|
|
|
|
Hi All !
I have Two ComboBox(With Their Items) And I Want to add These Items to A ListView in Two Column .
How can i do it?
thx for any reply !
|
|
|
|
|
Iterate the items in the ComboBox controls (I am assuming they both have the same number of items), create a ListViewItem, set its text and sub-item text and add it to the ListView.
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
We have an asp.net web application running in both .net 1.1 and 4.0. This application has a web.config file in the root folder where the authorization module is defined as
<authorization>
<allow users="*"/>
</authorization>
It has another web application in the sub directory where the web.config authorization module is as below
<authorization>
<allow roles="some valid role"/>
<deny users="*"/>
</authorization>
These configuration settings work fine in .net 1.1 but after migration to .net 4.0, the application is causing problems in providing appropriate access.
Is there any difference in reading the authorization module tags(<allow>,<deny>) of web.config of an application in .net 4.0 and 1.1 ?
|
|
|
|
|
They are using different authorizations schemes - the root authorization is user based only - the other requires a RoleProvider as well. Check you have an appropriate RoleProvider configured, and that the described role is enabled.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
The role access is checked for the logged in user, for whom the roles are defined in the database. There has been no change in the database neither in the role definition nor the access to the users. The problem is caused only after migration of the web application from 1.1 framework to 4.0 framework.
|
|
|
|
|
Perhaps you would like to ask this in the ASP.NET forum then. You are more likely to get an answer there.
|
|
|
|
|
hi i have a custom authentication used from
http://brianlegg.com/post/2011/05/09/Implementing-your-own-RoleProvider-and-MembershipProvider-in-MVC-3.aspx
i need to show a list of online users , can anyone help
|
|
|
|
|
A couple of thoughts;
As this is an ASP.NET issue, this should at least be asked in that forum rather than here.
Perhaps the author of the original code could help you. He's probably better placed to help you based on his code.
|
|
|
|
|
How I can dicipher a file with triples DES without Error, puisque j'ai essayer mais je récupér un texte en plus a la fin du fichier de sortie (la derniére ligne répéter), alors j'ai assurrer que c'est le dernier block et sachant que j'ai utilisé le formatage PKCS#7 et le mode CBC.
|
|
|
|
|
|
Think's JF2015 I'm succed to cipher ad decipher my data think you , my problem it was the file in input damaged , when i change the input file all was working good...
|
|
|
|
|
Greetings, you managed to insult both english and french languages in the same post...
No memory stick has been harmed during establishment of this signature.
|
|
|
|