Archive for the ‘ Visual Studio ’ Category

Visual Studio LightSwitch: An Integrated Development Environment for Managers

Microsoft is working on product called LightSwitch and release a beta version of Visual Studio LightSwitch on August 23, 2010. Visual Studio LightSwitch will come with pre-configured templates, pre-written code and other reusable components. Visual Studio LightSwitch also allows users to write custom code in Visual Basic .NET or C#. Applications developed using LightSwitch can be deployed on desktop, browser or on cloud.

Applications created with LightSwitch support exporting data to Microsoft Office Excel for fast and easy sharing and reporting. You can also attach your application to existing data sources, which makes it easy to collect, analyze, and reuse information from a variety of data sources including Microsoft SQL Server, Microsoft SQL Azure, SharePoint, Microsoft Office Access (post-Beta), and other third-party data sources.

With LightSwitch you can create custom applications for the way you do business. Keep your technology and business options open, while building a practical yet scalable application that matches your current needs now and in the future. The pre-built templates and components in LightSwitch are fully extensible, so you can get the specific functionality your application demands. In addition, your application can grow to meet the increasing demands of popular applications using the Microsoft Windows Azure Cloud Hosting option.

Identifying the exceptions thrown from a given method

.Net runtime throw a number of exceptions so it becomes really important to understand which exceptions may be thrown by a given base class library method. .Net Framework SDK contains a list of exceptions a given member may throw. Visual Studio 2008 allows you to view the list of all exceptions thrown by a base class library member (if any) simply by hovering your mouse cursor over the member name in the code window.

Identifying the exceptions thrown from a given method

Download Visual Studio 2010 and .NET Framework 4 Training Kit – February Release

The Visual Studio 2010 and .NET Framework 4 Training Kit includes presentations, hands-on labs, and demos. This content is designed to help you learn how to utilize the Visual Studio 2010 features and a variety of framework technologies including:

  • C# 4.0
  • Visual Basic 10
  • F#
  • Parallel Extensions
  • Windows Communication Foundation
  • Windows Workflow
  • Windows Presentation Foundation
  • ASP.NET 4
  • Windows 7
  • Entity Framework
  • ADO.NET Data Services
  • Managed Extensibility Framework
  • Visual Studio Team System

This version of the Training Kit works with Visual Studio 2010 RC and .NET Framework 4 RC.

  • Supported Operating Systems: Windows 7; Windows Server 2008; Windows Vista

Visual Studio 2010 RC .NET Framework 4 RC.

Instructions

Download and launch the self-extracting package. The Training Kit will uncompress to the selected folder and launch a HTML browser for the content.

Download Visual Studio 2010 and .NET Framework 4 Training Kit – February Release

Overview of Language Integrated Query

Language Integrated Query is one of the feature that ship with .Net Framework 3.5. LINQ is a set of language extension that allows developers to write queries using full power programming that they are using, programming language might be C#, VB or any of the .Net supported language.  In a simplest form LINQ defines keywords that a developer can use to build queries. LINQ expressions allows developers to select, sort,filter, group and transform data.

Same LINQ expression can be used with different type of data sources. For example, LINQ to Objects, the simplest form of LINQ, allows you to query collections of in-memory objects. LINQ to DataSet performs the same feat with the in-memory DataSet. Even more interesting are the two LINQ flavors that let you access external data: LINQ to SQL, which allows you to query a SQL Server database without writing data access code, and LINQ to XML, which allows you to read an XML file without using .NET’s specialized XML classes.

Let’s start with how LINQ work with in memory collections. This is called LINQ to objects or simple LINQ. LINQ to objects allows developers to eliminate logic of for each loop.

For example, imagine you want to get a list of all website that have a word .net

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
        ' Get the full collection of website from a helper method.
        Dim websitelist As List(Of Website) = Website.getWebsite
        'find a mathching website
        Dim matches As List(Of Website) = New List(Of Website)
        For Each websitename As Website In websitelist
            If websitename.websitename.Contains(".net") Then
                matches.Add(websitename)
            End If
        Next
    End Sub

Now perform the same task using LINQ

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click
    Dim websites As New List(Of Website)
    Dim matches As IEnumerable(Of Website)
    matches = From websitename In websites Where websitename.websitename.Contains(".net") Select websitename

End Sub

Website Class Code

Public Class Website
    Public websitename As String
    Public websiteurl As String

    Public Sub New(ByVal websitename As String, ByVal websiteurl As String)
        Me.websitename = websitename
        Me.websiteurl = websiteurl

    End Sub
    Public Shared Function getWebsite() As List(Of Website)
        Dim weblist As New List(Of Website)
        Dim web1 As New Website("Microsoft", "http://microsoft.com")
        weblist.Add(web1)
        Dim web2 As New Website("MSDN", "http://msdn.microsoft.com")
        weblist.Add(web2)
        Dim web3 As New Website("All About ASP.Net", "http://allaboutasp.net")
        weblist.Add(web3)
        Dim web4 As New Website("ReadersZone", "http://readerszone.com")
        weblist.Add(web4)
        Dim web5 As New Website("ASP.net", "http://asp.net")
        weblist.Add(web5)
        Dim web6 As New Website("Silverlight", "http://silverlight.net")
        weblist.Add(web6)
        Return (weblist)

    End Function

End Class

Public Class Website
    Public websitename As String
    Public websiteurl As String

    Public Sub New(ByVal websitename As String, ByVal websiteurl As String)
        Me.websitename = websitename
        Me.websiteurl = websiteurl

    End Sub
    Public Shared Function getWebsite() As List(Of Website)
        Dim weblist As New List(Of Website)
        Dim web1 As New Website("Microsoft", "http://microsoft.com")
        weblist.Add(web1)
        Dim web2 As New Website("MSDN", "http://msdn.microsoft.com")
        weblist.Add(web2)
        Dim web3 As New Website("All About ASP.Net", "http://allaboutasp.net")
        weblist.Add(web3)
        Dim web4 As New Website("ReadersZone", "http://readerszone.com")
        weblist.Add(web4)
        Dim web5 As New Website("ASP.net", "http://asp.net")
        weblist.Add(web5)
        Dim web6 As New Website("Silverlight", "http://silverlight.net")
        weblist.Add(web6)
        Return (weblist)

    End Function

End Class

How to Change Visual Studio Default DocType

Visual Studio 2008 When you create web pages in Visual Studio 2008, they are by default XHTML 1.0 Transitional. Sometimes developer want more control over the DocType or they want their pages to be XHTML 1.0 compliance. So you can also change the DocType or if you are using master pages then changing DocType is very easy just change the DocType in master page and all the child pages that use the master page will automatically acquire the DocType.

It is also possible to change the Visual Studio default page template also. To do this you first need to change the visual studio default page template and then build the visual studio template cache.

  • First you need to modify the visual studio template file. You can find the visual studio template file path “C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\Web\VisualBasic\1033\WebForm.zip”.
  • Unzip the webform.zip and modify these two file “WebForm.aspx and WebForm_cb.aspx”.
  • Simply change the DocType.
  • After updating the visual studio template files, delete the                            c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplatesCache folder to clear out the template cache.
  • Run Visual Studio using the following command line to rebuild the template cache:
    devenv /InstallVSTemplates

Technorati Tags: , ,