2007-11-19

RegularExpressions Class

The Regex class contains several static methods that allow you to use a regular expression without explicitly creating a Regex object. Using a static method is equivalent to constructing a Regex object, using it once and then destroying it.

Sample Code 1

Imports System.Text.RegularExpressions
' import the namespace

'instantiate the objects
dim oRegex as new regex("test pattern")

'use the object
If oRegex.IsMatch("this is the string to test on") Then
msgbox "Match found"
else
msgbox "Did not find match"
end i


Sample Code 2

//Check for correct format of your name

Dim myMatch As Match = System.Text.RegularExpressions.Regex.Match(InsertYourName, "^[A-Z][a-zA-Z]*$")

If Not myMatch.Success Then

'Name was incorrect

ErrorMessage("Invalid Name", "Message")

txtFname.Focus()

Return

End If


Regular Expressions Elements:

* . Character except a newline character(\n)
* \d Any decimal digit
* \D Any nondigit
* \s Any white-space character
* \S Any Non-white-space charater
* \w Any word character
* \W Any nonword character
* ^ Beginning of string or line
* \A Beginning of string
* $ End of string or line
* \z End of string
* | Matches one of the expressions seprated by the vertical bar; example eee|ttt will match one of eee or ttt (tracing left to right)
* [abc] Match with one of the characters; example [rghy] will match r, g,h or c not any other character.
* [^abc] Match with any of character except in list; example [ghj] will match all character except g,h or k.
* [a-z] Match any character within specified range; example [a - c] will match a, b or c.
* ( ) Subexpression treated as a single element by regular expression elements described in this table.
* ? Match one or zero occurrences of the previous character or subexpression; example a?b will match a or ab not aab.
* * Match zero or more occurences of the previous character or subexpression; example a*b will match b, ab, aab and so on.
* + Match one or more occurences of the previous character or subexpression; example a+b will match ab, aab and so on but not b.
* {n} Match exactly n occurrences of the preceding character;example a{2} will match only aa.
* {n,} Match minimum n occurrences of the preceding character;example a{2,} will match only aa,aaa and so on.
* {n,m} Match minimum n and maximum n occurrences of the preceding character;example a{2, 4} will match aa, aaa, aaaa but not aaaaa.

2007-11-15

Visual Studio 2008 Beta 2 Professional Edition

Product Information and Availability

Visual Studio 2008 and the .NET Framework 3.5 will be available by the end of November 2007. The .NET Framework 3.5 will also be available to end users via a free, optional download from Microsoft Update. A CTP of Microsoft Sync Framework is available today at http://msdn.microsoft.com/sync. Popfly Explorer is a hosted development environment available today at http://www.popfly.com. More information about all of these releases is available at http://www.msdn.microsoft.com/vstudio.
Founded in 1975, Microsoft (Nasdaq “MSFT”) is the worldwide leader in software, services and solutions that help people and businesses realize their full potential.
Note to editors: If you are interested in viewing additional information on Microsoft, please visit the Microsoft Web page at http://www.microsoft.com/presspass on Microsoft’s corporate information pages. Web links, telephone numbers and titles were correct at time of publication, but may since have changed. For additional assistance, journalists and analysts may contact Microsoft’s Rapid Response Team or other appropriate contacts listed at http://www.microsoft.com/presspass/contactpr.mspx.

Download beta version at : http://msdn2.microsoft.com/en-us/evalcenter/bb655864.aspx

2007-11-08

Copying Data from one DataTable to Another

You can use ImportRow method to do this by calling NewRow adds a row to the table using the existing table schema, but with default values for the row, and sets the DataRowState to Added. Calling ImportRow preserves the existing DataRowState along with other values in the row. If the DataRow that is passed as a parameter is in a detached state, it is ignored, and no exception is thrown.

Sample Code

For Each dr As DataRow In sourceTable.Rows

destinationTable.ImportRow(dr)

Next

But if the destination table have the same structure you can use this clone method copies the structure of the DataSet that including all datatable schemas, relations, and constraints.

Sample Code

Dim dsDestination As DataSet
' clone method copies the structure of the DataSet,
' including all datatable schemas, relations, and constraints
dsDestination = ds.Clone()

For Each dr As DataRow In ds.Tables(0).Rows
dsDestination.Tables(0).ImportRow(dr)
Next

vb.net sample code

2007-11-06

Developers slam Microsoft's Visual Basic plan

More than 100 influential developers using Microsoft products have signed a petition demanding the software company reconsider plans to end support for Visual Basic in its "classic" form.

The developers, members of Microsoft's Most Valuable Professional program which recognizes influential members of the developer community, claim the move could kill development on millions of Visual Basic 6 (VB6) applications and "strand" programmers that have not been trained in newer languages.

Microsoft said it will end standard support for Visual Basic 6 at the end of this month, ending free incident support and critical updates. Both services will be available for a fee for another three years.

But MVPs hope Microsoft will reconsider not just VB6's support options, but will continue to develop the language alongside its newer Visual Basic.Net.

"By providing a new version of a COM-based Visual Basic within the Visual Studio IDE, Microsoft will help maintain the value of its clients' existing code, demonstrate its ongoing commitment to the core Visual Basic language, and greatly simplify the adoption of VB.NET by those that wish to do so," the petition says. "The decisions of if, how, and when to migrate code to .NET should lie with the customer."

The problem, say the dissenting developers, is that when Microsoft made Visual Basic.Net (or Visual Basic 7) the successor to VB6, it actually killed one language and replaced it with a fundamentally different one. It's effectively impossible to migrate VB6 applications to VB.Net, and for VB6 developers, learning VB.Net is as complex as learning a completely new programming language, critics say.

"The .Net version of Visual Basic is Visual Basic in name only," wrote developer and author Rich Levin in a recent blog entry. "Any organization with an investment in Visual Basic code--consultants, ISVs, IT departments, businesses, schools, governments--are forced to freeze development of their existing VB code base, or reinvest virtually all the time, effort, intellectual property, and expense to rewrite their applications from scratch."

Microsoft continues to develop C++ alongside C#, the language's .Net counterpart, and the company should do the same with "classic" Visual Basic and VB.Net, the petition argues. Microsoft introduced VB.Net in 2000, and since then, developer use of VB6 and older versions has declined steadily. Many of those leaving the language behind are migrating not to VB.Net but to non-Microsoft languages such as Java, according to some surveys. For example, a November 2004 survey of developers in Europe, the Middle East and Africa by Evans Data found that Visual Basic had lost 25 percent of its developer base in those areas since 2003.

In North America most Visual Basic developers continued to use VB6 and older versions--45 percent of all North American developers, compared with 34 percent for Visual Basic.Net. Fifty-four percent of North American developers used some sort of Visual Basic.

"One of the main issues keeping VB6 and earlier developers from making the migration to VB.Net is the steepness of the learning curve," said Albion Butters, Evans Data's international analyst, in a statement. "The difficulty in moving existing VB6 apps to VB.Net is, in some cases, insurmountable."

While the developers' argument may make sense, it is probably a moot point, as Microsoft is unlikely to change its stance on VB6, say some industry observers.

"All software--desktop apps, languages, databases, whatever--gets 'end-of-lifed' eventually, some unfortunately, some fortunately," said Jez Higgins, a Birmingham-based developer. "The fundamental programming disciplines aren't tied to any one language or any one way or working. They won't disappear out the side of your head. I suggest these blokes buck up and get on."

"The future of programming is clear, and object-oriented languages designed from the get-go for Web and Internet-enabled functionality are the future," wrote one developer in response to Levin's post. "No amount of romanticizing VB6 is going to change that."

www.news.com

2007-11-02

DataSet

A data set (or dataset) is a collection of data, usually presented in tabular form. Each column represents a particular variable. Each row corresponds to a given member of the data set in question. It lists values for each of the variables, such as height and weight of an object or values of random numbers. The data set may comprise data for one or more members, corresponding to the number of rows.

Historically, the term originated in the mainframe field, where it had a well-defined meaning, very close to contemporary computer file. This topic is not covered here.

In the simplest case, there is only one variable, and then the data set consists of a single column of values, often represented as a list.

The values may be numbers, such as real numbers or integers, for example representing a person's height in centimeters, but may also be nominal data (i.e., not consisting of numerical values), for example representing a person's ethnicity. For each variable, the values will normally all be of the same kind. However, there may also be "missing values", which need to be indicated in some way.

In statistics data sets usually come from actual observations obtained by sampling a statistical population, and each row corresponds to the observations on one element of that population. Data sets may further be generated by algorithms for the purpose of testing certain kinds of software.

While the term suggests a relationship to set theory it should not be assumed that a given data set is, in fact, a set in the usual mathematically sense. The rows of a data set need not be distinct, and so a data set is technically a multiset.

From Wikipedia, the free encyclopedia