Snippet Editor

by Ken Tucker 31. December 2008 07:11

Bill McCarthy has moved the Snippet Editor project to Code Plex and added some nice new features


Features include:

  • Complete snippet file management
  • basic syntax coloring
  • replacement highlighting
  • drag and drop file organisation


The Snippet Editor is a stand-alone exe suitable for all versions
of Visual Studio 2005 and 2008 including the Express editions:


snippet_editor.png



The left hand pane provides for snippet collection management.
You can select which of your product collection to edit, filter the
collection based on a search phrase, add and remove snippets,
add existing folders, remove folders from the collection and
move snippets around by simple drag and drop.


snippet_navigation.png



The code editor provide basic syntax highlighting, and snippet
replacement highlighting, navigation, editing, adding and deleting.
Resize the code editor pane, collapse or expand the Properties,
Imports or References panes, and your layout is remembered for
next time you use the editor.



snippet_code.png

 

Download a copy today

http://www.codeplex.com/SnippetEditor


kick it on DotNetKicks.com

MSDN Tikihut tour at Space Coast .Net

by Ken Tucker 7. November 2008 15:38
When:
Wednesday, November 19, 2008 6:30 PM Eastern Time (US & Canada)
   Who: Joe Healy, Jeff Barnes, and Russ Fustino

 

http://www.dotnettikihut.com/


Event Overview

 

Session 1 - What’s New in SQL Server 2008 for Developers - SQL Server 2008 adds numerous new capabilities for developers – from support for Spatial Data types to a storage mechanism for SQL BLOB data using the NTFS file system, and much, much more. The new release also delivers several improvements to development-related areas, from T-SQL to SQLCLR to XML. This presentation will provide a technical dive into the latest and greatest features you’ll find in SQL Server 2008, while offering insight into how to effectively apply them to your upcoming development projects.

 

Session 2 – Build next generation applications with Silverlight 2.0 - Silverlight provides a powerful platform for building the next generation of rich interactive applications on the Internet. In this session, we’ll take a look at the programming model and tools that developers and designers can leverage to build these true next generation experiences for consumers and business, and demonstrate how to build a rich interactive application (RIA) using Silverlight and Microsoft .NET. We’ll explore how to use Microsoft Visual Studio to create applications, and  networking, how to retrieve data from a Web service, and various other aspects of building Silverlight applications.

 

Session 3 – Real World Application - How to create an end-to-end Mobile GPS tracking application using the .NET Compact Framework, WCF, LINQ, Silverlight, Deep Zoom, and Virtual Earth - Inspired by a true-story mobility case study recently published on the Microsoft.com website, this session will walk you through how to create a mobile GPS tracking application using the .NET Compact Framework, Windows Mobile SDK, and Compact SQL.   At the Web host layer,   we will create a Windows Communication Foundation service and generate a Compact framework client proxy to send the GPS tracks to a host web server - where finally, the GPS trail can then be viewed using LINQ, Silverlight, Deep Zoom, and Virtual Earth.

 

Optional Session 4 (dependent on available event time) - Power up your Office applications with VSTO - In this presentation, we’ll focus on the power and productivity of Visual Studio Tools for the Microsoft Office System (VSTO) – a .NET Smart Client technology. We’ll give you tips and tricks for designing and building smart client applications with VSTO, which allows you to create managed code applications with .NET languages including Microsoft Visual Basic .NET and Visual C#. VSTO also makes it simple to manifest the functionality of those applications in the rich user interfaces of Microsoft Office Excel, Word, PowerPoint, Visio, Outlook and others from the Office stack. VSTO addresses some of the biggest challenges that Office solution developers are facing today, including separation of data and view elements, server-side and offline scenarios, seamless integration with the Visual Studio tools, deployment and updating. Join us for this eye-opening session and learn just how easy it is to build and deploy powerful applications with VSTO.

 

Please Register if you plan to attend this event.

https://msevents.microsoft.com/CUI/Register.aspx?culture=en-US&EventID=1032392616&CountryCode=US&IsRedirect=false



kick it on DotNetKicks.com

Use Linq to create a random list of numbers

by Ken Tucker 3. December 2007 21:14

Here is a simple linq query which places the numbers from 1 and 150 in a random order

 

Dim r As New Random(Now.Ticks Mod Int32.MaxValue)

Dim rndLst = From l In (From num In Enumerable.Range(1, 150) _
             Select New With {.Num = num, .pos = r.Next(1, 150)}) _
             Order By l.pos _
             Select l.Num

For Each i In rndLst
    Console.WriteLine(i)
Next


kick it on DotNetKicks.com

Get VS 2008 for Free

by Ken Tucker 29. November 2007 03:19

The Space Coast .Net User Group will be having VS 2008 install fest on Dec 18, 2007 @ 6:30PM

Bring your laptop to the meeting room at Charlie and Jakes and the great Joe Healy will allow you to install a copy of Visual Studio 2008 professional for free.  While Visual Studio 2008 is installing buy yourself something to eat or drink and have some fun.


** Visual Studio 2008 must be installed at the meeting **
**  Pease uninstall any Orcas or VS 2008 betas before the meeting **

 

There are a limited number of copies of VS 2008 available

 

Register if You plan to attend

 

Don't live in Brevard County Florida but still want a free copy of VS 2008 pro check out Tim Heuer's Blog to see if there is a install fest near you.

 http://timheuer.com/blog/archive/2007/11/27/get-visual-studio-2008-professional-for-free-installfest.aspx

 


kick it on DotNetKicks.com

Change the Framework Version of a Project in VS 2008

by Ken Tucker 26. November 2007 17:52

Visual Studio 2008 allows you to switch which version of the .net framework your project targets.  The available options are 2.0, 3.0, and 3.5. 

To change the framework version open up your project properties compile tab

 

 

You will find the framework option combobox on the form that opens when you press the Advanced Compile Options button

 

 

 

Visual studio will save the project, close, and finally restart with project opened up when you change the framwork version for your project


kick it on DotNetKicks.com

Linq to DataSet

by Ken Tucker 8. November 2007 18:05

Linq allows you to query the data in a dataset.  For this example I load the Products and Categories table from the Northwind Database.  I then do a join query to export the Product Name, Unit Price, and Category Name into a list which I display in a datagridview.  Note a query of this type will not display in a datagridview you need to set the datasource equal to the query's Tolist method.

Imports System.Data.SqlClient

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim strConn As String = _
                "Server = .\SQLEXPRESS;Database = NorthWind; Integrated Security = SSPI;"
        Dim conn As New SqlConnection(strConn)
        Dim da As New SqlDataAdapter("Select * from Products; Select * from Categories", conn)
        Dim ds As New DataSet
        da.Fill(ds)
        Debug.Print(ds.Tables(1).TableName)
        Dim products As DataTable = ds.Tables(0)
        Dim categories As DataTable = ds.Tables(1)
        Dim query = From p In products.AsEnumerable _
                    Join c In categories.AsEnumerable _
                    On p.Field(Of Int32)("CategoryID") Equals c.Field(Of Int32)("CategoryID") _
                    Select New With {.ProductName = p.Field(Of String)("ProductName"), _
                                    .Price = p.Field(Of Decimal)("UnitPrice"), _
                                    .Category = c.Field(Of String)("CategoryName")}

        DataGridView1.DataSource = query.ToList
    End Sub
End Class

Paging a Windows Forms DataGridView with LINQ

by Ken Tucker 6. November 2007 09:43

Since Visual Studio 2008 is due out by the end of the Month I am updating some of my datagridview samples for LINQ.

To start off create a new windows forms application in VS 2008 make sure you select FrameWork 3.5 so you can use linq

 

 

 

I now added a new Linq to Sql designer to the project and named it Northwind.  Drag the Northwind Products Table on to the design surface from the Server Explorer.

 

 

 

 

 

On your windows forms add a DataGridView (DataGridView1) and a NumericUpDown control (nuPage).  For this example I will have the datagridview show 15 items at a time.  In the form load event we will figure out how many pages there are and load the first 15 items into the datagridview.  In the NumericUpdown controls value changed event we will update the data displayed

 

Public Class Form1
    Dim bs As New BindingSource

    Private intPages As Integer
    Dim db As New NorthwindDataContext

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        intPages = Math.Ceiling(db.Products.Count / 15)
        nuPage.Maximum = intPages
        nuPage.Minimum = 1
        Dim p = From prod In db.Products _
                Select prod Skip 0 Take 15
        bs.DataSource = p
        bs.AllowNew = False
        DataGridView1.DataSource = bs
    End Sub


    Private Sub nuPage_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles nuPage.ValueChanged
        Dim p = From prod In db.Products _
                Select prod Skip (nuPage.Value - 1) * 15 Take 15
        bs.DataSource = p
    End Sub
End Class

VB 2008 Extension Methods

by Ken Tucker 30. June 2007 04:12

VB 2008 Extension Methods


Visual Basic 2008 adds a new features called extension methods.   These allow you to add a method, or function to a type.  For this example we will add an IsGuid function to strings.  All extension methods must be placed in a module.  The function or method must be marked as an extension and the first argument is the type the method extends.



Imports System.Runtime.CompilerServices
Imports System.Text.RegularExpressions

Module Module1

    Sub Main()
        Dim g As String = "82ee4145-632c-42a1-83b9-57ec163eaa17"
        Dim g1 As String = "82ee4145-632c-42a1-83b9-57ec163ea17"

        Console.WriteLine(g & IIf(g.IsGuid, " is ", " is not ") & "a valid guid")
        Console.WriteLine(g1 & IIf(g1.IsGuid, " is ", " is not ") & "a valid guid")
    End Sub

End Module

Public Module MyExtensions

    <Extension()> _
    Public Function IsGuid(ByVal s As String) As Boolean
        Dim regGuid As New Regex("^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", RegexOptions.Compiled)
        Return regGuid.IsMatch(s)
    End Function
End Module