|
|
|
Duplicate the SET operating system command
|
Total Hit (2582) |
The Environment.GetEnvironmentVariables property returns the list of all the environment variables, as an IDictionary object. If you want to display them sorted by their name, as the SET command does at the prompt, you need the following tricky code:
«Code LangId=2»
' Get all the variables, as a
....Read More |
Rating
|
|
|
Disable .NET security
|
Total Hit (2050) |
The .NET Framework enforces secuity at several levels. For example, assemblies downloaded from the Internet have very limited permissions (especially after installing the Service Pack 1 of the Framework). This means that many operations that would be legal in some cases may throw an exception in oth
....Read More |
Rating
|
|
|
Using aliases to quickly change the type of variables
|
Total Hit (3159) |
It may happen that you have to define a lot of variable of some type, and you want the possibility to later change their type without manually change the declaration of all of them. You can't use a simple Find & Replace, because you don't want to change the type of ALL the variables of that original
....Read More |
Rating
|
|
|
Adding styles to the font of the selected text of a RichTextBox
|
Total Hit (2100) |
«Code LangId=2»' Add a style to the selection of a RichTextBox,
' without deleting the current styles that may be already
' present in the selection or in portions of it
'
' Example: AddFontStyle(richTextBox1, FontStyle.Bold)
Public Sub AddFontStyle(ByVal rtb As RichTextBox, _
ByVal styl
....Read More |
Rating
|
|
|
Language features - Array
|
Total Hit (8741) |
Arrays allow you to refer to a series of variables by the same name and to use a number, called an index or subscript, to tell them apart. This helps you create shorter and simpler code in many situations, because you can set up loops that deal efficiently with any number of elements by using the in
....Read More |
Rating
|
|
|
A macro to protect a code section with a Try...Catch block
|
Total Hit (3000) |
When you're working with the Visual Studio .NET code editor, typing a Try keyword plus the Enter key automatically creates the End Try statement. The following simple macro does something more interesting: it lets you select a portion of code and protect it with a Try...Catch...Finally...End Try blo
....Read More |
Rating
|
|
|
|
How to install Compact Framework on Windows Pocket PC
|
Total Hit (2375) |
It may sound easy but I had hard time to find this.
To install Compact Framework on windows pocket pc perform the following steps
1. Download Compact Framework msi file from Microsoft Download center
2. Save downloaded file to some location (e.g. c:\downloads\NETCFSetupv2.msi)
3. Goto Start
....Read More |
Rating
|
|
|
|
Display a directory tree
|
Total Hit (3959) |
Thanks to the GetDirectories and GetFiles methods of the System.IO.Directory class, you need very little code to iterate over all the directories and files of a directory tree. For example, the following code snippet prints the structure of a directory tree and (optionally) the name of files in each
....Read More |
Rating
|
|
|
Handle child XML nodes with care
|
Total Hit (2641) |
When you work with XML documents loaded into an XmlDocument class, you often need to examine the contents of child nodes. The XMLDOM programming interface purposedly provides the ChildNodes property. In the .NET XmlDocument class, ChildNodes returns an internal object of type XmlChildNodes. (The obj
....Read More |
Rating
|
|
|
|
|
|
Language features - Variables and types
|
Total Hit (2609) |
The Microsoft .NET Framework provides a robust system of primitive types to store and represent data in your application. Data primitives represent integer numbers, floating-point numbers, Boolean values, characters, and strings.
In VB.net you can declare variable using Dim statement as shown be
....Read More |
Rating
|
|
|
How Do I...Read and Write a Schema?
|
Total Hit (561) |
This sample illustrates how to read an XML Schema Definition language (XSD) file into the Schema Object Model (SOM). Then, the sample writes the XSD schema which has been loaded into memory to a StringWriter for display to the screen. The schema could also be written to a file using an XmlWriter.
....Read More |
Rating
|
|
|
How Do I...Start and stop a process?
|
Total Hit (993) |
You can use the Process component to accomplish most process management tasks quickly and easily. You can use this component to work with processes on either local or remote computers. On a local computer, you can, for example, start and stop a process.
....Read More |
Rating
|
|
|
An Introduction to Regular Expressions and Their Use in .NET II...
|
Total Hit (1547) |
In the first article in this series we introduced background information regarding regular expressions as well as starting to look at the support for regular expressions in .NET. In this article we'll look in more detail at this latter area.
|
Rating
|
|
|
Real Time syntax highlighting [wrapper class]
|
Total Hit (2581) |
Hello again. This time I wanted to bring you something that was really challenging for me to build. I must have tried at least four totally different solutions to this problem consuming literally days of my time until I reached the best one. At the request of our beloved staff, I will attempt to exp
....Read More |
Rating
|
|
|
Safe, Simple Multithreading in Windows Forms, Part 1
|
Total Hit (1067) |
It all started innocently enough. I found myself needing to calculate the area of a circle for the first time in .NET. This called, of course, for an accurate representation of pi. System.Math.PI is handy, but since it only provides 20 digits of precision, I was worried about the accuracy of my calc
....Read More |
Rating
|
|
|
|
ADO.NET: Use Database Transactions
|
Total Hit (608) |
Database transactions are used to control data commitment to databases. For example, in standard account procedures, it is necessary to debit one account and credit another at the same time. Since computers break down on occasion (power outages, network outages, and so on) there is the potential for
....Read More |
Rating
|
|
|
How Do I...Pass Simple Data from .NET Code to VB6 code?
|
Total Hit (751) |
This example demonstrates how to use .NET objects from a Visual Basic 6.0 application. The same technique can be used to create the object from any COM application, including those built with Visual C++ 6.0, VBScript, or JScript.
|
Rating
|
|
|
Fun With DrawImage
|
Total Hit (1257) |
If you've ever tried to rotate an image in VB6, you know how tedious it can be. Sure, given plenty of time for trial and error, combined with some reasonably tricky mathematics and a little patience, you can figure out how to map pixels from the source image into the rotated destination image. Enter
....Read More |
Rating
|
|
|
How Do I...Create System Resources During Installation?
|
Total Hit (846) |
An application can consist not only of traditional program files, but also of associated resources such as message queues, event logs, and performance counters that must be created on the deployment destination. You can configure your application to create these resources when your application is in
....Read More |
Rating
|
|
|
ADO.NET: Generate XML with data from SQL Server
|
Total Hit (590) |
This sample illustrates how to produce XML from SQL Server using two different techniques. The first uses the ExecuteXmlReader method of SqlCommand to get an XmlTextReader, which is then populated into a DataSet using the ReadXml method of the DataSet class. The second uses the SqlDataAdapter to ext
....Read More |
Rating
|
|
|
Embedding MSDE SQL Engine in a Visual Studios .Net Setup application
|
Total Hit (1385) |
This document is a step by step description of adding SQL server to an Windows Application and embedding the MSDE engine into the application setup and installer program. By doing this you will automate the installation of the SQL server, the mounting of the datafiles and granting access to your app
....Read More |
Rating
|
|
|