Snippet: Cattura dell’output di un comando DOS

Dim myProcess As New Process Dim myProcessStartInfo As New ProcessStartInfo(“cmd.exe”) myProcessStartInfo.Arguments = “/C dir c:” myProcessStartInfo.UseShellExecute = False myProcessStartInfo.RedirectStandardOutput = True myProcess.StartInfo = myProcessStartInfo myProcess.Start() Console.WriteLine(myProcess.StandardOutput.ReadToEnd) myProcess.Close()

L’attributo AmbientValue

Shawn Burke in un thread su .NET 247 chiarisce l’utilizzo dell’attributo AmbientValue: Shawn Burke [MSFT] AmbientValueAttribute is for properties that inherit settings from other places. For example the Font or Cursor properties on Control will report their Parent’s value if they aren’t set. But the code generation engine doesn’t know this. The most common place that … Leggi tutto

Appunti su Longhorn Preview

Al Longhorn Developer Preview dello scorso 6 Febbraio sono state date delle anticipazioni sulle nuove tecnologie contenute in Longhorn e su come sviluppare oggi applicazioni con un occhio al futuro. Innazitutto si è tenuto a precisare che queste nuove tecnologie affiancheranno quelle esistenti , quindi le applicazioni legacy continueranno a funzionare, ma che i presupposto per … Leggi tutto

PropertyGrid: gestione delle date nulle

Ha volte capita di voler gestire tramite il controllo PropertyGrid delle date i cui valori sono memorizzati in un database, diventa quindi necessario gestire il caso della data nulla. Si supponga  di avere la seguente tabella: Config     ID (PK String)     Data (Date) per cui si è proveduto a generare una DataTest tipizzato ConfigSchema … Leggi tutto

Simulare l’evento Validating

A volte può capitare (almeno a me) di utilizzare l’evento Validanting per delle decodifiche (xes IDCliente – RagioneSociale) appare chiaro che in situazioni come questa sarebbe utile avere una funzione PerformValidating, che invochi l’elaborazione contenuta nell’evento e ci dica se la validazione è riuscita o meno, da utilizzare quando modifichiamo il record per evitare la … Leggi tutto

Tutto quello che avreste voluto sapere sull’Owner-Drawing

http://msdn.microsoft.com/msdnmag/issues/04/02/CuttingEdge/default.aspx In questo articolo Dino Esposito tratta in maniera approfondita i seguenti argomenti: – Customizing Menu Rendering – Overriding the Menu of a Form – The MeasureItem Event – The DrawItem Event – Painting the Menu Item – Context Menu and TextBoxes – Using Graphical Menus Seamlessly e risponde implicitamente ad un mio dubbio circa … Leggi tutto

La classe System.Windows.Forms.SystemInformation

Esplorando il Namespace System.Windows.Forms mi sono imbattuto nella classe System.Windows.Forms.SystemInformation che consente di ricavare tramite le sue proprietà Shared moltissime informazioni legate all’interfaccia utente e al sistema. Ecco alcuni esempi:         System.Windows.Forms.SystemInformation.BootMode         System.Windows.Forms.SystemInformation.MouseButtons         System.Windows.Forms.SystemInformation.MousePresent         System.Windows.Forms.SystemInformation.MouseWheelPresent         System.Windows.Forms.SystemInformation.Network         System.Windows.Forms.SystemInformation.MonitorCount         System.Windows.Forms.SystemInformation.PrimaryMonitorSize         System.Windows.Forms.SystemInformation.BorderSize         System.Windows.Forms.SystemInformation.CaptionHeight         System.Windows.Forms.SystemInformation.HorizontalScrollBarHeight         System.Windows.Forms.SystemInformation.VerticalScrollBarWidth