Archive for October, 2008
Iterate Over all Fields and Properties in an Object with vb.net
Posted by Kelly's Chronicles in Uncategorized on October 31, 2008
Good Morning. Yesterday I was going mad. I needed to get the extended properties (like subject, author etc) of a file but without adding a reference to any new components. If you know how to do this in 1.1 of the Framework I would love to hear from you.
Anyway continuing the same theme as most of this week, we want to iterate over all fields and properties of a an object. This is code for .NET Framework 2.0 or above. Make it a great day!
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim mlA As New MyLabel Dim value As Object Dim T As Type = mlA.GetType For Each pi As System.Reflection.PropertyInfo In T.GetProperties If pi.CanRead AndAlso pi.CanWrite Then value = pi.GetValue(mlA, Nothing) Debug.Print(pi.Name) If Not IsNothing(value) Then Debug.Print(value.ToString) End If Debug.Print("--------------------") End If Next For Each fi As System.Reflection.FieldInfo In T.GetFields Debug.Print(fi.Name) value = fi.GetValue(mlA) If Not IsNothing(value) Then Debug.Print(value.ToString) End If Debug.Print("--------------------") Next End Sub End Class Public Class MyLabel Inherits Label Public ContainerDay1 As Integer Public ContainerDay2 As Integer Public ContainerDay3 As Integer Public ContainerDay4 As Integer Public ContainerDay5 As Integer ' ... End Class
Use Reflection to access Friend Function with vb.net
Posted by Kelly's Chronicles in vb.net on October 30, 2008
Good Morning! First let me throw a shout out to Brian K. Woytovich who has a very cool, real to life blog. I encourage you to visit and hear what he has to say.
My topic today is one that I have been meaning to blog about.. Like yesterday’s blog entry sometimes we need to find a better way to access methods and properties of classes without loops. So we want to access a friend function of another class by using reflection. So here it is and make it a great day.
Imports System.Reflection Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim tc As New TestClass() Dim tcSayHello As MethodInfo = tc.GetType().GetMethod("SayHello", _ BindingFlags.NonPublic Or BindingFlags.Instance) tcSayHello.Invoke(tc, Nothing) Dim tcGetMessage As MethodInfo = tc.GetType().GetMethod("GetMessage", _ BindingFlags.NonPublic Or BindingFlags.Instance) Dim params() As Object = {"Kelly Martens"} MessageBox.Show(tcGetMessage.Invoke(tc, params)) End Sub End Class ========================================================== Public Class TestClass Friend Sub SayHello() Console.WriteLine("Hello") End Sub Friend Function GetMessage(ByVal name As String) As String Return "Hello " & name End Function End Class
Specify a class property name with a string variable in vb.net
Posted by Kelly's Chronicles in Uncategorized on October 29, 2008
Good morning all. Well watching "The Shield" last night was not real fulfilling. Like Vic was really going to take Shane down in a parking lot of a hospital. Then there was Dutch doing his best from being seduced by a woman old enough to be his mother. For once, I admired Billings better than Dutch for his willingness to do something about the threat to his family. The good news is next week’s episode looks more promising.
You might be wondering what is up with yesterday’s posting. Well my plan is to take each namespace shown there and its classes therein and explore them in separate blog postings. Its a big undertaking but it will put some rhyme and reason to the things I post.
Of course today is not the day that will start due to a development in a project I am working on. 🙂
I was in a situation where I had an instance of a class called "employee". The properties of employee also happen to be the same as the database table called employee. I had one variable representing the table name and one representing the column name. The original plan was to loop through the columns of the table till I found a match with my employee class property and write the value once I found the right property. The problem was that every time a loop occurred a new database call was needing to be made which made the end result occur quite slowly. (I did not design the employee class. Actually the way they did it was really cool but how were they to know they were going to find themselves in this situation at the time?) So I had to find a way to make my column variable and the employee class properties be able to interact.
So here is how I did it.
First I changed the column variable to object type instead of string. One line of code then observations.
employee.GetType.GetProperty(columnname).GetValue(employee, Nothing)
1. The GetType(Employee) returns an instance of Type that represent the class "Employee".
2. GetProperty(columnname) on the Type object returned from step 1 gives me the PropertyInfo that represent the shared property Instance of type Employee.
3. GetValue() on the returned PropertyInfo from step 2 returns me the value of Employee.(columnname – what that propertys name is).
Anyway, make it a great day!
.NET Framework 3.5 Commonly Used Types and Namespaces Part 1
Posted by Kelly's Chronicles in Uncategorized on October 28, 2008
Good morning. Woke up late and so it is.
This is here as much for me as for you. Sometimes I am somewhere where I don’t have a book handy. Here is a poster which won’t be here forever due to its size and the the namespace listing and MS links.
-
Contains classes that are necessary for the ASP.NET management console application to interact with the Microsoft Management Console (MMC).
- Microsoft.Build.BuildEngine
-
Contains the classes that represent the MSBuild engine.
- Microsoft.Build.Framework
-
Contains classes that make up the tasks, loggers, and events of MSBuild.
- Microsoft.Build.Tasks
-
Contains the implementation of all tasks shipping with MSBuild.
- Microsoft.Build.Tasks.Deployment.Bootstrapper
-
Contains classes used internally by MSBuild.
- Microsoft.Build.Tasks.Deployment.ManifestUtilities
-
Contains classes used internally by MSBuild.
- Microsoft.Build.Utilities
-
Provides helper classes that you can use to create your own MSBuild loggers and tasks.
- Microsoft.Csharp
-
Contains classes that support compilation and code generation using the C# language.
- Microsoft.JScript
-
Contains classes that support compilation and code generation using the JScript language.
- Microsoft.SqlServer.Server
-
Contains classes that are specific to the integration of the Microsoft .NET Framework common language runtime (CLR) component into Microsoft SQL Server, and the SQL Server database engine process execution environment.
- Microsoft.VisualBasic
-
Contains classes that support compilation and code generation using the Visual Basic language.
- Microsoft.VisualBasic.ApplicationServices
-
Contains types that support the Visual Basic Application Model and provide access to application information.
- Microsoft.VisualBasic.CompilerServices
-
Contains internal-use only types that support the Visual Basic compiler.
- Microsoft.VisualBasic.Devices
-
Contains types that support the My objects related to devices in Visual Basic.
- Microsoft.VisualBasic.FileIO
-
Contains types that support the My file system object in Visual Basic.
- Microsoft.VisualBasic.Logging
-
Contains types that support the My logging objects in Visual Basic and provides a simple log listener that directs logging output to file.
- Microsoft.VisualBasic.MyServices
-
Contains types that support My in Visual Basic.
- Microsoft.VisualBasic.MyServices.Internal
-
Contains internal-use only types that support My in Visual Basic.
- Microsoft.VisualBasic.Vsa
- Microsoft.VisualC
- Microsoft.Vsa
-
Contains interfaces that allow you to integrate script for the .NET Framework script engines into applications, and to compile and execute code at run time.
- Microsoft.Vsa.Vb.CodeDOM
- Microsoft.Win32
-
Provides two types of classes: those that handle events raised by the operating system and those that manipulate the system registry.
- Microsoft.Win32.SafeHandles
-
Contains classes that are abstract derivations of safe handle classes that provide common functionality supporting file and operating system handles.
- Microsoft.WindowsCE.Forms
-
Contains classes for developing Pocket PC and Smartphone Windows Forms applications using the .NET Compact Framework.
- Microsoft.WindowsMobile.DirectX
-
Contains classes for developing DirectX applications on devices with the .NET Compact Framework. Requires a future release of Windows Mobile to run the applications.
- Microsoft.WindowsMobile.DirectX.Direct3D
-
Contains classes for developing Direct3D applications on devices with the .NET Compact Framework. Requires a future release of Windows Mobile to run the applications.
- Microsoft_VsaVb
- System
-
Contains fundamental classes and base classes that define commonly used value and reference data types, events and event handlers, interfaces, attributes, and processing exceptions. Other classes provide services supporting data type conversion, method parameter manipulation, mathematics, remote and local program invocation, application environment management, and supervision of managed and unmanaged applications.
- System.CodeDom
-
Contains classes that can be used to represent the elements and structure of a source code document. These elements can be used to model the structure of a source code document that can be output as source code in a supported language using the functionality provided by the System.CodeDom.Compiler namespace.
- System.CodeDom.Compiler
-
Contains types for managing the generation and compilation of source code in supported programming languages. Code generators can each produce source code in a particular programming language based on the structure of Code Document Object Model (CodeDOM) source code models consisting of elements provided by the System.CodeDom namespace.
- System.Collections
-
Contains interfaces and classes that define various collections of objects, such as lists, queues, bit arrays, hashtables and dictionaries.
- System.Collections.Generic
-
Contains interfaces and classes that define generic collections, which allow users to create strongly typed collections that provide better type safety and performance than non-generic strongly typed collections.
- System.Collections.ObjectModel
-
Contains classes that can be used as collections in the object model of a reusable library. Use these classes when properties or methods return collections.
- System.Collections.Specialized
-
Contains specialized and strongly typed collections; for example, a linked list dictionary, a bit vector, and collections that contain only strings.
- System.ComponentModel
-
Provides classes that are used to implement the run-time and design-time behavior of components and controls. This namespace includes the base classes and interfaces for implementing attributes and type converters, binding to data sources, and licensing components.
- System.ComponentModel.Design
-
Contains classes that developers can use to build custom design-time behavior for components and user interfaces for configuring components at design time. The design time environment provides systems that enable developers to arrange components and configure their properties.
- System.ComponentModel.Design.Data
-
Contains classes for implementing design-time behavior of data-related components.
- System.ComponentModel.Design.Serialization
-
Provides types that support customization and control of serialization at design time.
- System.Configuration
-
Contains the types that provide the programming model for handling configuration data.
- System.Configuration.Assemblies
-
Contains classes that are used to configure an assembly.
- System.Configuration.Install
-
Provides classes that allow you to write custom installers for your own components. The Installer class is the base class for all custom installers in the .NET Framework.
- System.Configuration.Provider
-
Contains the base classes shared by both server and client applications to support a pluggable model to easily add or remove functionality.
- System.Data
-
Contains classes that constitute most of the ADO.NET architecture. The ADO.NET architecture enables you to build components that efficiently manage data from multiple data sources. In a disconnected scenario (such as the Internet), ADO.NET provides the tools to request, update, and reconcile data in multiple tier systems. The ADO.NET architecture is also implemented in client applications, such as Windows Forms, or HTML pages created by ASP.NET.
- System.Data.Common
-
Contains classes shared by the .NET Framework data providers. A .NET Framework data provider describes a collection of classes used to access a data source, such as a database, in the managed space.
- System.Data.Design
-
Contains classes that can be used to generate a custom typed-dataset.
- System.Data.Linq
-
Contains classes to access relational data as objects. DataContext and related classes can be used for Reading, Creating, Updating and Deleting objects mapped to a database using mapping specified as attributes in your object model or in a separate external XML file.
- System.Data.Linq.Mapping
-
Provides programmatic access to mapping information used by LINQ to SQL.
- System.Data.Odbc
-
Contains classes that encapsulate the .NET Framework Data Provider for ODBC. The .NET Framework Data Provider for ODBC describes a collection of classes used to access an ODBC data source in the managed space.
- System.Data.OleDb
-
Contains classes that encapsulate the .NET Framework Data Provider for OLE DB. The .NET Framework Data Provider for OLE DB describes a collection of classes used to access an OLE DB data source in the managed space.
- System.Data.OracleClient
-
Contains classes that encapsulate the .NET Framework Data Provider for Oracle. The .NET Framework Data Provider for Oracle describes a collection of classes used to access an Oracle data source in the managed space.
- System.Data.Sql
-
Contains classes that support SQL Server-specific functionality. The API extensions in this class add to the .NET Framework Data Provider for SQL Server (System.Data.SqlClient).
- System.Data.SqlClient
-
Contains classes that encapsulate the .NET Framework Data Provider for SQL Server. The .NET Framework Data Provider for SQL Server describes a collection of classes used to access a SQL Server database in the managed space.
- System.Data.SqlServerCE
-
Describes a collection of classes that can be used to access a database in SQL Server CE from Windows CE-based devices in the managed environment. With this namespace you can create SQL Server CE databases on a device and also establish connections to SQL Server databases that are on a device or on a remote server.
- System.Data.SqlTypes
-
Contains classes for native data types within SQL Server. These classes provide a faster alternative to other data types. Using the classes in this namespace helps prevent type conversion errors caused in situations where loss of precision could occur. Because other data types are converted to and from SqlTypes behind the scenes, explicitly creating and using objects within this namespace results in faster code as well.
- System.Diagnostics
-
Provides classes that allow you to interact with system processes, event logs, and performance counters. This namespace also provides classes that allow you to debug your application and to trace the execution of your code. For more information, see the Trace and Debug classes.
- System.Diagnostics.CodeAnalysis
-
Contains classes for interaction with code analysis tools. Code analysis tools are used to analyze code for conformance to coding conventions such as naming or security rules.
- System.Diagnostics.Design
-
Contains classes that can be used to extend design-time support for application monitoring and instrumentation.
- System.Diagnostics.SymbolStore
-
Provides classes that allow you to read and write debug symbol information, such as source line to Microsoft intermediate language (MSIL) maps. Compilers targeting the .NET Framework can store the debug symbol information into programmer’s database (PDB) files. Debuggers and code profiler tools can read the debug symbol information at run time.
- System.DirectoryServices
-
Provides easy access to Active Directory from managed code. The namespace contains two component classes, DirectoryEntry and DirectorySearcher, which use the Active Directory Services Interfaces (ADSI) technology. ADSI is the set of interfaces that Microsoft provides as a flexible tool for working with a variety of network providers. ADSI gives the administrator the ability to locate and manage resources on a network with relative ease, regardless of the network’s size.
- System.DirectoryServices.ActiveDirectory
-
Provides a high level abstraction object model that builds around Microsoft® Active Directory® directory service tasks. The Active Directory® directory service concepts such as forest, domain, site, subnet, partition and schema are part of the object model.
- System.DirectoryServices.Protocols
-
Provides the methods defined in the Lightweight Directory Access Protocol (LDAP) version 3 (V3) and Directory Services Markup Language (DSML) version 2 (V2) standards.
- System.Drawing
-
Provides access to GDI+ basic graphics functionality. More advanced functionality is provided in the System.Drawing.Drawing2D, System.Drawing.Imaging, and System.Drawing.Text namespaces.
- System.Drawing.Design
-
Contains classes that extend design-time user interface (UI) logic and drawing. You can further extend this design-time functionality to create custom toolbox items, type-specific value editors that can edit and graphically represent values of their supported types, or type converters that can convert values between certain types. This namespace provides the basic frameworks for developing extensions to the design-time UI.
- System.Drawing.Drawing2D
-
Provides advanced 2-dimensional and vector graphics functionality. This namespace includes the gradient brushes, the Matrix class (used to define geometric transforms), and the GraphicsPath class.
- System.Drawing.Imaging
-
Provides advanced GDI+ imaging functionality. Basic graphics functionality is provided by the System.Drawing namespace.
- System.Drawing.Printing
-
Provides print-related services. Typically, you create a new instance of the PrintDocument class, set the properties that describe what to print, and call the Print method to actually print the document.
- System.Drawing.Text
-
Provides advanced GDI+ typography functionality. Basic graphics functionality is provided by the System.Drawing namespace. The classes in this namespace allow users to create and use collections of fonts.
- System.EnterpriseServices
-
Provides an important infrastructure for enterprise applications. COM+ provides a services architecture for component programming models deployed in an enterprise environment. This namespace provides .NET Framework objects with access to COM+ services, making the .NET Framework objects more practical for enterprise applications.
- System.EnterpriseServices.CompensatingResourceManager
-
Provides classes that allow you to use a Compensating Resource Manager (CRM) in managed code. A CRM is a service provided by COM+ that enables you to include non-transactional objects in Microsoft Distributed Transaction Coordinator (DTC) transactions. Although CRMs do not provide the capabilities of a full resource manager, they do provide transactional atomicity (all-or-nothing behavior) and durability through the recovery log.
- System.EnterpriseServices.Internal
-
Provides infrastructure support for COM+ services. The classes and interfaces in this namespace are specifically intended to support calls into System.EnterpriseServices from the unmanaged COM+ classes.
- System.Globalization
-
Contains classes that define culture-related information, including the language, the country/region, the calendars in use, the format patterns for dates, currency, and numbers, and the sort order for strings. These classes are useful for writing globalized (internationalized) applications.
- System.IO
-
Contains types that allow synchronous and asynchronous reading and writing on data streams and files.
- System.IO.Compression
-
Contains classes that provide basic compression and decompression for streams.
- System.IO.IsolatedStorage
-
Contains types that allow the creation and use of isolated stores. With these stores, you can read and write data that less trusted code cannot access and help prevent the exposure of sensitive information that can be saved elsewhere on the file system. Data is stored in compartments that are isolated by the current user and by the assembly in which the code exists.
- System.IO.Ports
-
Contains classes that control serial ports, providing a framework for synchronous and event-driven I/O, access to pin and break states, access to serial driver properties, and enumerations for specifying port characteristics.
- System.Linq
-
Provides classes and interfaces that support queries that use Language-Integrated Query (LINQ).
- System.Linq.Expressions
-
Contains classes, interfaces and enumerations that enable language-level code expressions to be represented as objects in the form of expression trees.
- System.Management
-
Provides access to a rich set of management information and management events about the system, devices, and applications instrumented to the Windows Management Instrumentation (WMI) infrastructure.
- System.Management.Instrumentation
-
Provides the classes necessary for instrumenting applications for management and exposing their management information and events through WMI to potential consumers. Consumers such as Microsoft Application Center or Microsoft Operations Manager can then manage your application easily, and monitoring and configuring of your application is available for administrator scripts or other applications, both managed as well as unmanaged.
- System.Messaging
-
Provides classes that allow you to connect to, monitor, and administer message queues on the network and send, receive, or peek messages.
- System.Messaging.Design
-
Contains classes that can be used to extend design-time support for System.Messaging classes.
.NET Framework 3.5 Commonly Used Types and Namespaces Part 2
Posted by Kelly's Chronicles in Uncategorized on October 28, 2008
Good morning. Woke up late and so it is.
This is here as much for me as for you. Sometimes I am somewhere where I don’t have a book handy. Here is a poster which won’t be here forever due to its size and the the namespace listing and MS links.
Provides a simple programming interface for many of the protocols used on networks today. The WebRequest and WebResponse classes form the basis of what are called pluggable protocols, an implementation of network services that enables you to develop applications that use Internet resources without worrying about the specific details of the individual protocols.
Defines the types and enumerations used to define cache policies for resources obtained using the WebRequest and HttpWebRequest classes.
Contains classes that applications use to programmatically access and update configuration settings for the System.Net namespaces.
Contains classes used to send electronic mail to a Simple Mail Transfer Protocol (SMTP) server for delivery.
Holds types that are used to represent Multipurpose Internet Mail Exchange (MIME) headers. These types are used with the types in the System.Net.Mail namespace to specify Content-Type, Content-Disposition and Content-transfer-Encoding headers when sending email using the SmtpClient class.
Provides access to network traffic data, network address information, and notification of address changes for the local computer. The namespace also contains classes that implement the Ping utility. You can use Ping and related classes to check whether a computer is reachable across the network.
Provides a managed implementation of the Windows Sockets (Winsock) interface for developers who need to help control access to the network.
Contains classes and interfaces that provide a managed view of loaded types, methods, and fields, with the ability to dynamically create and invoke types.
Contains classes that allow a compiler or tool to emit metadata and Microsoft intermediate language (MSIL) and optionally generate a PE file on disk. The primary clients of these classes are script engines and compilers.
Provides classes and interfaces that allow developers to create, store, and manage various culture-specific resources used in an application.
Contains the StronglyTypedResourceBuilder class, which provides support for strongly-typed resources. Beginning with the .NET Framework version 2.0, this compile-time feature encapsulates access to resources by creating classes that contain a set of static read-only (get) properties, thus making it easier to consume resources.
Contains advanced types that support diverse namespaces such as System, the Runtime namespaces, and the Security namespaces.
Defines a set of types that enumerate and define a contract for reliability between the author of some code, and the developers who take a dependency on that code.
Contains advanced types that are used in application activation within application domains.
Provides functionality for compiler writers using managed code to specify attributes in metadata that affect the run-time behavior of the common language runtime. The classes in this namespace are for compiler writers use only.
Provides a wide variety of members that support COM interop and platform invoke services. If you are unfamiliar with these services, see Interoperating with Unmanaged Code.
Contains methods that are definitions of COM functions for managed code. These functions replace the now-obsolete UCOM* methods in the System.Runtime.InteropServices namespace.
Supports the .NET infrastructure and is not intended to be used directly from your code.
Contains the IExpando interface which allows modification of an object by adding or removing its members.
Provides classes and interfaces that allow developers to create and configure distributed applications.
Provides classes and objects that support server and client activation of remote objects.
Contains classes that support and handle channels and channel sinks, which are used as the transport medium when a client calls a method on a remote object.
Contains channels that use the HTTP protocol to transport messages and objects to and from remote locations. By default, the HTTP channels encode objects and method calls in SOAP format for transmission, but other encoding and decoding formatter sinks can be specified in the configuration properties of a channel.
Defines a communication channel for remoting that uses the Interprocess Communication (IPC) system of the Windows operating system. Because it does not use network communication, the IPC channel is much faster than the HTTP and TCP channels, but it can only be used for communication between application domains on the same physical computer.
Contains channels that use the TCP protocol to transport messages and objects to and from remote locations. By default, the TCP channels encode objects and method calls in binary format for transmission, but other encoding and decoding formatter sinks can be specified in the configuration properties of a channel.
Contains objects that define the contexts all objects reside within. A context is an ordered sequence of properties that defines an environment for the objects within it. Contexts are created during the activation process for objects that are configured to require certain automatic services such synchronization, transactions, just-in-time (JIT) activation, security, and so on. Multiple objects can live inside a context.
Contains classes that manage the lifetime of remote objects. Traditionally, distributed garbage collection uses reference counts and pinging for control over the lifetime of objects. This works well when there are a few clients per service, but doesn’t scale well when there are thousands of clients per service. The remoting lifetime service associates a lease with each service, and deletes a service when its lease time expires. The lifetime service can take on the function of a traditional distributed garbage collector, and it also adjusts well when the numbers of clients per server increases.
Contains classes used to create and remote messages. The remoting infrastructure uses messages to communicate with remote objects. Messages are used to transmit remote method calls, to activate remote objects, and to communicate information. A message object carries a set of named properties, including action identifiers, envoy information, and parameters.
Contains classes and attributes that can be used to customize generation and processing of SOAP for objects and fields. The classes of this namespace can be used to indicate the SOAPAction, type output, XML element name, and the method XML namespace URI.
Contains the XML Schema Definition (XSD) defined by the World Wide Web Consortium (W3C) in 2001. The XML Schema Part2: Data types specification from W3C identifies format and behavior of various data types. This namespace contains wrapper classes for the data types that conform to the W3C specification. All date and time types conform to the ISO standards specification.
Contains the classes used by the Soapsuds.exe command line tool and the user code to convert metadata to and from XML schema for the remoting infrastructure.
Contains classes that control and provide functionality for proxies. A proxy is a local object that is an image of a remote object. Proxies enable clients to access objects across remoting boundaries.
Contains service classes that provide functionality to the .NET Framework.
Contains classes that can be used for serializing and deserializing objects. Serialization is the process of converting an object or a graph of objects into a linear sequence of bytes for either storage or transmission to another location. Deserialization is the process of taking in stored information and recreating objects from it.
Provides common enumerations, interfaces, and classes that are used by serialization formatters.
Contains the BinaryFormatter class, which can be used to serialize and deserialize objects in binary format.
Contains the SoapFormatter class, which can be used to serialize and deserialize objects in the SOAP format.
Provides the underlying structure of the .NET Framework security system, including base classes for permissions.
Provides cryptographic services, including secure encoding and decoding of data, as well as many other operations, such as hashing, random number generation, and message authentication.
Provides programming elements for Public Key Cryptography Standards (PKCS), including methods for signing data, exchanging keys, requesting certificates, public key encryption and decryption, and other security functions.
Contains the common language runtime implementation of the Authenticode X.509 v.3 certificate. This certificate is signed with a private key that uniquely and positively identifies the holder of the certificate.
Contains classes to support the creation and validation of XML digital signatures. The classes in this namespace implement the World Wide Web Consortium Recommendation, "XML-Signature Syntax and Processing", described at http://www.w3.org/TR/xmldsig-core/.
Defines classes that control access to operations and resources based on policy.
Contains code groups, membership conditions, and evidence. These three types of classes are used to create the rules applied by the .NET Framework security policy system. Evidence classes are the input to security policy and membership conditions are the switches; together these create policy statements and determine the granted permission set. Policy levels and code groups are the structure of the policy hierarchy. Code groups are the encapsulation of a rule and are arranged hierarchically in a policy level.
Defines a principal object that represents the security context under which code is running.
Provides classes that allow you to implement, install, and control Windows service applications. Services are long-running executables that run without a user interface. Implementing a service involves inheriting from the ServiceBase class and defining specific behavior to process when start, stop, pause, and continue commands are passed in, as well as custom behavior and actions to take when the system shuts down.
Contains classes representing ASCII, Unicode, UTF-7, and UTF-8 character encodings; abstract base classes for converting blocks of characters to and from blocks of bytes; and a helper class that manipulates and formats String objects without creating intermediate instances of String.
Contains classes that provide access to the .NET Framework regular expression engine. The namespace provides regular expression functionality that can be used from any platform or language that runs within the Microsoft .NET Framework.
Provides classes and interfaces that enable multithreaded programming. In addition to classes for synchronizing thread activities and access to data (Mutex, Monitor, Interlocked, AutoResetEvent, and so on), this namespace includes a ThreadPool class that allows you to use a pool of system-supplied threads, and a Timer class that executes callback methods on thread pool threads.
Provides the Timer component, which allows you to raise an event on a specified interval.
Contains classes that allow your code to participate in transactions. The classes support transactions with multiple, distributed participants, multiple phase notifications, and durable enlistments..
Contains classes that describe configuration options used by System.Transactions classes
Supplies classes and interfaces that enable browser-server communication. This namespace includes the HttpRequest class, which provides extensive information about the current HTTP request, the HttpResponse class, which manages HTTP output to the client, and the HttpServerUtility class, which provides access to server-side utilities and processes. System.Web also includes classes for cookie manipulation, file transfer, exception information, and output cache control.
Provides classes for caching frequently used data on the server. This includes the Cache class, a dictionary that allows you to store arbitrary data objects, such as hash tables and data sets. It also provides expiration functionality for those objects, and methods that allow you to add and remove the objects. You can also add the objects with a dependency upon other files or cache entries, and perform a callback to notify your application when an object is removed from the cache.
Contains classes for generating and compiling custom file types within the ASP.NET build environment.
Contains classes that are used to set up ASP.NET configuration.
Contains HTTP handler classes that process HTTP requests to a Web server.
Provides the functionality for hosting ASP.NET applications from managed applications outside of Microsoft Internet Information Services (IIS).
The classes in this namespace are obsolete; use the classes in the System.Net.Mail namespace. Contains classes that enable you to construct and send messages using the CDOSYS message component. The mail message is delivered through either the SMTP mail service built into Microsoft Windows 2000 or through an arbitrary SMTP server. The classes in this namespace can be used either from ASP.NET or from any managed application.
Contains classes and interfaces for managing and monitoring the health of Web applications.
Contains the core capabilities, including authentication and error-handling, required for building ASP.NET mobile Web applications.
Contains classes that are used to implement the ASP.NET user profile in Web server applications.
Provides regular expressions used to parse ASP.NET files. All members of the System.Web.RegularExpressions namespace are descendants of the Regex class.
Contains classes that are used to implement ASP.NET security in Web server applications.
Consists of the classes that enable you to create XML Web services using ASP.NET and XML Web service clients. XML Web services are applications that provide the ability to exchange messages in a loosely coupled environment using standard protocols such as HTTP, XML, XSD, SOAP, and WSDL. XML Web services enable the building of modular applications within and across companies in heterogeneous environments making them interoperable with a broad variety of implementations, platforms and devices. The SOAP-based XML messages of these applications can have well-defined (structured and typed), or loosely defined parts (using arbitrary XML). The ability of the messages to evolve over time without breaking the protocol is fundamental to the flexibility and robustness of XML Web services as a building block for the future of the Web.
Consists of the classes that configure how XML Web services created using ASP.NET run.
Consists of the classes that enable you to publicly describe an XML Web service by using the Web Services Description Language (WSDL). Each class in this namespace corresponds to a specific element in the WSDL specification, and the class hierarchy corresponds to the XML structure of a valid WSDL document.
Consists of the classes that allow XML Web service clients to locate the available XML Web services on a Web server through a process called XML Web services Discovery.
Consists of the classes that define the protocols used to transmit data across the wire during the communication between XML Web service clients and XML Web services created using ASP.NET.
Supplies classes and interfaces that enable storage of data specific to a single client within a Web application on the server. The session state data is used to give the client the appearance of a persistent connection with the application. State information can be stored within local process memory or, for Web farm configurations, out-of-process using either the ASP.NET State Service or a SQL Server database.
Provides classes and interfaces that allow you to create controls and pages that will appear in your Web applications as user interface on a Web page. This namespace includes the Control class, which provides all controls, whether HTML, Web, or User controls, with a common set of functionality. It also includes the Page control, which is generated automatically whenever a request is made for a page in your Web application. Also provided are classes which provide the Web Forms Server Controls data binding functionality, the ability to save the view state of a given control or page, as well as parsing functionality for both programmable and literal controls.
Contains the base classes for control adapters and page adapters, which you can use to override lifecycle states of pages and controls to modify their default markup or behavior for new markup standards or for specific browsers.
Contains classes that can be used to extend design-time support for Web Forms and Web server controls.
Obsolete. Contains classes that provide design-time support for the classes in the System.Web.UI.MobileControls namespace. The classes in this namespace are obsolete; use the classes in System.Web.UI.Design.WebControls instead.
Contains classes that provide design-time support for data type converters in mobile controls.
Contains classes that can be used to extend design-time support for Web server controls.
Contains classes that provide design-time support for controls derived from classes in the System.Web.UI.WebControls.WebParts namespace.
Consists of a collection of classes that allow you to create HTML server controls on a Web Forms page. HTML server controls run on the server and map directly to standard HTML tags supported by most browsers. This allows you to programmatically control the HTML elements on a Web Forms page.
Obsolete. Contains a set of ASP.NET server controls that can intelligently render your application for different mobile devices. The classes in this namespace are obsolete; use the controls in System.Web.UI.WebControls instead.
Contains classes you can use to override lifecycle stages of a mobile control to modify its default HTML, CHTML, or WML markup or behavior for new markup standards or for specific browsers and mobile devices.
Contains classes you can use to override lifecycle stages of a mobile control to modify its default XHTML markup or behavior for new markup standards or for specific browsers and mobile devices.
Contains classes that allow you to create Web server controls on a Web page. Web server controls run on the server and include form controls such as buttons and text boxes. They also include special purpose controls such as a calendar. Because Web server controls run on the server, you can programmatically control these elements. Web server controls are more abstract than HTML server controls. Their object model does not necessarily reflect HTML syntax.
Contains classes you can use to override lifecycle stages of a Web control to modify a control’s default markup or behavior for new markup standards or for specific browsers.
Contains an integrated set of classes and interfaces for creating Web pages whose appearance and behavior can be modified (personalized) by end users. The user-defined settings for each page are saved for future browser sessions.
Contains classes that enable callback methods to be run under the scope of a transaction and that enable work to be posted to separate threads.
Contains classes for creating Windows-based applications that take full advantage of the rich user interface features available in the Microsoft Windows operating system.
Contains helper classes that Visual Studio uses to display property pages while in design mode.
Contains classes that support design-time configuration and behavior for Windows Forms components. These classes consist of: Designer classes that provide support for Windows Forms components, a set of design time services, UITypeEditor classes for configuring certain types of properties, and classes for importing ActiveX controls.
Contains classes for creating custom user interface behavior for components at design time.
Contains classes that support design-time and run-time layout behaviors.
Provides internal support for the PropertyGrid control. The classes in this namespace support the .NET Framework infrastructure and are not intended to be used directly from your code
Provides standards-based support for processing XML.
Contains the XML classes that provide standards-based support for XML Schemas definition language (XSD) schemas.
Contains classes that are used to serialize objects into XML format documents or streams.
Contains the XPath parser and evaluation engine. It supports the W3C XML Path Language (XPath) Version 1.0 Recommendation (www.w3.org/TR/xpath).
Provides support for Extensible Stylesheet Transformation (XSLT) transforms. It supports the W3C XSL Transformations (XSLT) Version 1.0 Recommendation (www.w3.org/TR/xslt).
Provides internal support for the classes in the System.Xml.Xsl namespace. The classes in this namespace support the .NET Framework infrastructure and are not intended to be used directly from your code.
Write DataSet to a Microsoft Word Document with an Array using vb.net
Posted by Kelly's Chronicles in Uncategorized on October 27, 2008
Good Morning everyone! My weekend was not all that great on a personal level. I was pretty much down for the count with the flu all weekend. It seems when the seasons change it just hits me. But on a work level, I did well. I came up with the GUI design for the implementation of a Crystal Reports type interface allowing people to build templates for emails they send out. It may not sound like much but believe me, getting this part down was a huge step. The biggest challenge was finding a way to do everything we needed to do and yet conserve work space area in the document even for those with 800 x 600 monitors.
Anyway, this is a subject I think many developers would like to hear about. MS Word is extremely slow to automate. Their can be no dispute about this. Writing a huge amount of data to the document is a trying and perilous task. Unlike Excel so many things can go wrong.
What we want to do is write the dataset table to an array first, then write the array to a text string, place the text on the document at the required insertion point and then convert it to a table. It is not as fast as my sample doing this with Excel, but it is must faster than doing it cell by cell and is at least doable with vb.net and MS Word. This sample will work with any MS Word version except Word 97 and below and on any version of the .NET Framework.
Thanks and make it a great day!
‘Note vba is not zero based….
Dim rows As Integer = dsreport.Tables.Item(0).Rows.Count
Dim columns As Integer = dsreport.Tables.Item(0).Columns.Count
‘creating the array that will hold our data
Dim DataArray(rows, columns) As Object
‘writing the data to the array
For c = 0 To columns – 1
DataArray(r, c) = dsreport.Tables(0).Columns.Item(c).ColumnName
For r = 0 To rows – 1
DataArray(r, c) = dsreport.Tables(0).Rows(r).Item(c)
Next
Next
‘creating a range at the Word Document insertion point
Dim oRange = oDoc.Content.Application.Selection.Range
‘creating a string to hold what is in our array
Dim oTemp As String
For r = 0 To rows – 1
For c = 0 To columns – 1
oTemp = oTemp & DataArray(r, c) & vbTab
Next
Next
‘writing the text to our document. It is not a table yet.
oRange.Text = oTemp
‘convert it to a table using vba and you are done!
oRange.ConvertToTable(Separator:=wdSeparateByTabs, NumColumns:=dsreport.Tables(0).Columns.Count, _
NumRows:=dsreport.Tables(0).Rows.Count – 1, AutoFitBehavior:=wdAutoFitContent)
Technorati Tags: vb.net,vba,MS Word,document,dataset,array,slow,automation,.NET Framework,GE Healthcare
Verify Email Address is Valid with vb.net
Posted by Kelly's Chronicles in Uncategorized on October 24, 2008
Good morning. As of this writing, the stock market appears to be on the verge of a complete collapse today. They have already halted selling and the market has not even opened due to the fall the futures market has already taken. Watching my retirement fly out the window as my broker is telling me to sit tight is not an easy thing for me to do. I am a person that has trouble sitting idly by and doing nothing. But that is my own character defect.
Anyway, the task before me is simple yet needed. I want to verify that the user has actually entered a valid email address. We are checking to make sure it is in a format that is an email address, not whether or not it is a legitimate email address. we accomplish by using regular expressions. To be honest, the regular expressions subject torments me. I don’t care for it but it works here nicely.
Make it a great day!
Imports System.Text.RegularExpressions
Function EmailAddressCheck(ByVal emailAddress As String) As Boolean
Dim pattern As String = "^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"
Dim emailAddressMatch As Match = Regex.Match(emailAddress, pattern)
If emailAddressMatch.Success Then
EmailAddressCheck = True
Else
EmailAddressCheck = False
End If
End Function
Technorati Tags: address,vb.net,.NET Framework,csharp,Verify,Email,Valid,user,subject,System,Text,RegularExpressions,Match,Regex
Windows Live Tags: address,vb.net,.NET Framework,csharp,Verify,Email,Valid,user,subject,System,Text,RegularExpressions,Match,Regex
Connect to me on LinkedIn
Posted by Kelly's Chronicles in Uncategorized on October 23, 2008
First, lets get the advertisement for myself out of the way…..
I have a Linkedin page here and would love to have those of you who have a technical background and are familiar with my work here on my blog or elsewhere connect with me there. So please click on the link. And if you are so inclined you can write me a recommendation. 🙂 They really do help enhance your profile.
LinkedIn is a business-oriented social networking site founded in December 2002 and launched in May 2003 mainly used for professional networking.
Thank You!
My Wish for Windows Live Spaces
Posted by Kelly's Chronicles in Uncategorized on October 21, 2008
I have enjoyed my experience with blogging here.
But I do have one request. I would like better statistics. I would like to be able to view what browser they are using, the complete name of the blog entry visited, where they came from, where they went after they left. I would like to know how long they stayed visiting a blog entry. I would like to see averages per day, percentages of what search engine gave me hits (mine are 90 percent from Google).
There are so many things you can do with these kinds of statistics. I am surprised they are not already implemented.
Anyway just my thought.
Convert hwnd to Process Name using vb.net
Posted by Kelly's Chronicles in Uncategorized on October 21, 2008
Good morning everyone. I had a pretty lousy day yesterday. Teh specs on my email project got turned upside down yesterday and then wasted a lot of time at the DMV then finding out I was going to have to come back the next day anyway. Oh well. It’s gotta get better today.
Well anyway, the title petty much says it all in this case. We want to return the actual process name the hwnd represents. Make it a great day!
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Lst = ListBox1 '--------> ADD THIS LINE EnumWindows(AddressOf EnumWindowsCallBack, 0) End Sub End Class Module Module1 Private Declare Auto Function GetWindowThreadProcessId Lib "user32.dll" (ByVal hWnd As IntPtr,
ByRef ProcessID As Integer) As Integer Public Lst As ListBox Public Delegate Function EnumWindowsProc(ByVal hwnd As IntPtr, ByVal lParam As Int32) As Int32 Public Declare Function EnumWindows Lib "user32.dll" _ (ByVal lpEnumFunc As EnumWindowsProc, ByVal lParam As Int32) As Int32 Public Declare Function GetWindowTextLength Lib "user32.dll" Alias "GetWindowTextLengthA" _ (ByVal hwnd As IntPtr) As Int32 Public Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" _ (ByVal hwnd As IntPtr, ByVal lpString As String, ByVal cch As Int32) As Int32 'Callback function to enum windows Public Function EnumWindowsCallBack(ByVal hwnd As IntPtr, ByVal lParam As Int32) As Int32 Dim sSave As String Dim ProcessID As Long GetWindowThreadProcessId(hwnd, ProcessID) Dim processLB As Process Dim tempProc As Process = processLB.GetProcessById(ProcessID) Dim processName As String = tempProc.ProcessName If (processName = "notepad") Then 'Get the windowtext length sSave = Space(GetWindowTextLength(hwnd) + 1) 'get the window text GetWindowText(hwnd, sSave, Len(sSave)) 'remove the last Chr(0) sSave = Microsoft.VisualBasic.Left(sSave, Len(sSave) - 1) 'Error below: Reference to a non-shared member requires an Object Reference Lst.Items.Add(sSave) 'Lst.Items.Add(processName) If sSave.Trim <> "" Then Debug.WriteLine(sSave) End If End If Return 1 'continue enumeration End Function End Module
Recent Comments