/Home /Archive /Syndicate /Blog /Support /About /Contact  
All Visual Basic Feeds in one place!





Channel: Mike McIntyre

I was given this requirement for a Visual Basic application I am creating: When a user right clicks an item in a Windows Forms ListBox, select the item. Luckily I quickly found an example... ...( read more )


Looking for Windows Phone 7 code examples for VB.Net? Checkout this MSDN page: ...( read more )
Download it now at:  Windows Phone 7 RTW for Visual Basic ...( read more )


This week I needed a simple text box control that could display text vertically, something like this:   Here's what I came up with:     Public Class VerticalTextBox Inherits System.Windows.Forms.Control Public Sub New() End Sub Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) Dim g As Graphics = e.Graphics Using format As New StringFormat(StringFormatFlags.DirectionVertical) Using brush As New SolidBrush(ForeColor) g.Dr ... [ read more ]
At Microsoft's PASS Summit 2010 attendees were introduced to Project “Crescent”, a stunning new data visualization experience coming in the SQL “Denali”. Built on Silverlight, Crescent gives users new ways of exploring data and discovering new insights, and presenting this information in new and exciting ways, letting the data tell a story about your business.   Learn more and watch the video: A Glimpse at Project Crescent Project Cresc ... [ read more ]


Visual Studio 2010 provides project templates you can use to create add-ins to automate Visio, extend Visio features, or customize the Visio user interface (UI). The Visio object model exposes many classes to automate Visio to create diagrams for organizational charts, flowcharts, project timelines, network diagrams, office spaces, and more. Get started here:  Visio Solutions
Create Your Second Visual Basic 2010 Application    Your second Visual Basic 2010 application will also be a Windows console application.     This application will be able to ask the user for two numbers, sum the two numbers, and show the result to the user. ...( read more )


I run into a lot of people wanting to learn how to create shareware or trial versions of their software. This oldie but goodie from MSDN is a great place to start. Shareware Starter Kit


This is the Third in a series of blog posts designed to take you, one step at a time, from a beginner to an advanced Visual Basic 2010 programmer. Along the way you will create a Console application, a Windows Forms application, a Windows WPF application, an ASP.Net Web Site, ASP.Net Web Services, a Silverlight application, a Windows Phone application, and a LightSwitch application. Understanding Your First Visual Basic 2010 Application By now you ... [ read more ]


Free ebook: Programming Windows Phone 7, by Charles Petzold Get it by clicking here .


This is the second in a series of blog posts designed to take you, one step at a time, from a beginner to an advanced Visual Basic 2010 programmer. Along the way you will create a Console application, a Windows Forms application, a Windows WPF application, an ASP.Net Web Site, ASP.Net Web Services, a Silverlight application, a Windows Phone application, and a LightSwitch application. ...( read more )


This is the first in a series of blog posts designed to take you, one step at a time, from a beginner to an advanced Visual Basic 2010 programmer. Along the way you will create a Console application, a Windows Forms application, a Windows WPF application, an ASP.Net Web Site, ASP.Net Web Services, a Silverlight application, a Windows Phone application, and a LightSwitch application.   To provide a rich learning experience I'm going to mix co ... [ read more ]


Last week I installed a Visual Basic 2008 application that automates Outlook 2007 running on Windows 7 on 12 computers. The application sends emails via each application user's Outlook 2007. On most of the computers the application could send emails...( read more )


It's official.  You can use Visual Basic to create Windows Phone 7 applications. I've been working with the bits for the past few days and it's a blast.  ...( read more )


The more I use Visual Studio LightSwitch Beta 2 the more uses I find for it. This week I used it to rapidly build a design for part of a point-of-sale system I am developing. ...( read more )


I used the code below to create an application that can create and send Outlook 2007 emails containing the contents of Word 2007 documents. ...( read more )


Here's a post that explains how VB.NET can be used with Windows Phone 7: Windows Phone 7 and VB.Net
The Attributes property of the System.IO.FileInfo class is used to get or set file attributes. Some commonly used file attributes are Archive, Compressed, Directory, Encrypted, Hidden, Normal, ReadOnly, System, and Temporary. ...( read more )


You can optimize your application's performance in many ways. In this article learn how to optimize performance by the way you design your procedures. ...( read more )


Today Microsoft released Visual Studio LightSwitch to MSDN subscribers.  Pulic release is scheduled for next Monday, August 23rd. I'm installing it on one of my development computers now. Resources available now: LightSwitch Developer Center LightSwitch Beta 1 Documentation on MSDN  Vision Clinic Application Walkthrough and Sample LightSwitch Forum Look for more resources next Monday.


I use Visual Studio help all the time. Over time its grown very large in order to accomodate all Visual Studio Languages, technologies, and more. Visual Studio 2010 Help works differently that previous versions of Visual Studio. I feel some new features are an improvement, some are not. I feel more can be done to make "Help" provide better help. What do you think? What ideas have you had to improve Visual Studio help?


Microsoft has announced the Beta release of a new product: Visual Studio LightSwitch.  The Beta is scheduled for release on August 23, 2010. To learn more visit the Visual Studio LightSwitch site -> Visual Studio LightSwitch This product targets non-professional business application developers e.g. business managers. For my clients this is a good thing.  I work with a lot of business managers, accountants, and small business owners that need to create small b ... [ read more ]
A sometimes forgotten step for making a Sql Server Analysis Services cube available to end users... ...( read more )


  <Extension()> _ Public Sub SelectAllRows(ByVal dataGridView As DataGridView) For Each dgRow As DataGridViewRow In dataGridView.Rows dgRow.Selected = False Next End Sub <Extension()> _ Public Sub UnSelectAllRows(ByVal dataGridView As DataGridView) For Each dgRow As DataGridViewRow In dataGridView.Rows dgRow.Selected = False Next End Sub dp.SyntaxHighlighter.ClipboardSwf = '/dp.SyntaxHighlighter/Scripts/clipboard.swf' dp.SyntaxHighlighter.Highlight ... [ read more ]


It's a common need to provide fuctionality to users for checking and unchecking ALL CheckedListBox items: You can implement the check all and uncheck all logic using extension methods. The code below shows how to add CheckAll and UncheckAll extension methods to the Windows Forms CheckedListBox class. Public Module ExtensionMethods <Extension()> _ Public Sub CheckAll(ByVal checkedListBox As CheckedListBox) For i As Integer = 0 To checkedList ... [ read more ]


In my previous blog post I demonstrated how to add and IsNothing extension method to the .NET Framework Object class. Here's another extension method I regularly use:  IsInteger for the .NET Framework String class: <Extension()> _ Public Function IsInteger(ByVal argument As String) As Boolean Return Integer.TryParse(argument, Nothing) End Function dp.SyntaxHighlighter.ClipboardSwf = '/dp.SyntaxHighlighter/Scripts/clipboard.swf' dp.SyntaxHighlighter.Highligh ... [ read more ]


Extension methods were added to Visual Basic in 2008. I often use them in programs to add methods to .Net framework classes, for example to extend the Object class to include an 'IsNothing' method: Public Module ExtensionMethods <Extension()> _ Public Function IsNothing(ByVal obj As Object) Return If(obj Is Nothing, True, False) End Function End Module dp.SyntaxHighlighter.ClipboardSwf = '/dp.SyntaxHighlighter/Scripts/clipboard.s ... [ read more ]


Download the Windows Phone Developer Tools CTP Refresh (WPDT CTP) from http://developer.windowsphone.com . This refresh provides what you need to build Windows Phone 7 apps on the final release of Visual Studio 2010 (VS2010).


Check out the 'VB and C# Coevolution' blog by Microsoft's Product Unit Manager for Visual Studio Languages, Scott Wildimuth: VB and C# Coevolution


Apply the Visual Basic  HideModuleName attribute to hide a module's name from intellisense. This attribute is useful for extending the Visual Basic My namespace. Here's an example... ...( read more )
More About PLINQ Why PLINQ? Since my last post a couple of friends asked me: "Why PLINQ?".... ...( read more )


Unless you explicitly set a Silverlight 3 page's TabNavigation property to 'Cycle', a user can tab off the Silverlight page to the browsers address bar and behond. See the TabNavigation property assignment in the XAML code below ...( read more )


When you add rounded values together, always rounding .5 in the same direction results in a bias that grows with the more numbers you add together. This is sometimes called "Common Rounding". One way to minimize the bias is with banker's rounding. ...( read more )
Silverlight can popup a new browser window by calling the System.Windows.Browser HtmlWindow.PopUpWindow method. ...( read more )


Sometimes a Silverlight application needs to navigate to a .aspx page in the web site root from which it is being hosted. One way to do this is to use the HtmlPage class. ...( read more )
This blog post provides an example of parallel programing with Visual Basic 2010. This example uses Parallel Linq (PLINQ) which is a parallel implementation of LINQ to Objects. PLINQ implements the full set of LINQ standard query operators as extension methods for the T:System.Linq namespace and has additional operators for parallel operations. PLINQ queries scale in the degree of concurrency based on the capabilities of the host computer. PLINQ increases the speed of LINQ to O ... [ read more ]


Would you like to create applications that utilize multiple cores (CPUs)? Would you like to enable multiple threads to be executed simultaneously? ...( read more )


Hot off the press is the   Visual Studio 2010 and .NET Framework 4 Training Kit release for the VS 2010 Release Candiate! This kit include VB support, and is a great resource for VB developers who want to get up to speed with VS 2010 and .NET 4.


Have you concatenated strings together with the ampersand (&) in Visual Basic?  I've proabably done this over a 100,000 times in my programming carreer.         Dim message As String         message = message & "Dear " & salutation & " " & firstName & " " & lastName   The .Net String class provides another way to concatenate string ... [ read more ]


After years of pain customizing Microsoft Office applications I decided to look for a third-party tool that would relieve my pain. I found one. It is 'Add-in Express for .NET' from Add-in Express. For the past six weeks I've been using Add-in Express to catch up on my Microsoft Office projects and have come to appreciate this tool very much which is why I decided to tell you about it in my blog.......( read more )


A Predicate(Of T) represents the method that defines a set of criteria and determines whether the specified object meets those criteria. This post provides an example of using Predicate(Of T) to find items in a generic list ( List(Of T) ). It includes examples for both the List.Find and List.FindAll methods. ...( read more )


Document windows such as the Code Editor and Design view window in VS2010 can be floated outside the IDE window. I'm finding this feature extremely useful on my wide monitors and when I am using two monitors at the same time. ...( read more )
The solution in this example demonstrates a very simple example of calling a WCF service from a Silverlight 3 application. Web Site WCF Service Silverlight 3 Client The three main elements of the example are the WCF service contained in the examples web project, the XAML of the Silverlight 'MainPage', and the code of the 'Main Page'. ...( read more )


Want to get ahead of the curve?  Want to be prepared for Visual Studio 2010? If so, Microsoft has a training kit for you: Training Kit I've spent the last two weeks working through the kit. It's been worth the effort. Even though I had already spent a lot of time with Visual Studio 2010,  I learned a lot more about it from the kit.  It was fun.  I recommend the kit to anyone who plans to use Visual Studio 2010.


Below is a class that contains a method that can create a DataTable object form Linq Query Results. I find the LINQToDataTable method really handy when I am creating Crystal reports. Crystal Reports love to report on DataTables. The Imports are essential to the LINQToDataTable method in the LinqUtilities class. Imports System.Data Imports System.Linq Imports System.Reflection   Public Class LinqUtilities     Friend Shared Function LINQToDataTable( Of ... [ read more ]


Heres a short exmaple to get you thinking about how query results can be joined to tables for purposes such as attaching summary data. The example below shows how a query that sums total sales for a product can be joined to a query that selects product ID and product name from the Products table in Microsoft's Adventure Works sample database. SELECT PROD.ProductID, PROD.[Name], ISNULL(SALES.ProductSales,0) ProductSales FROM Production.Product PROD LEFT JOIN ( SELECT ProductId, SUM ... [ read more ]


There are changes to the Visual Studio 2010 help system that you'll want to learn about. For example, the new 'Manage Help Settings' menu item: The menu item opens the new 'Help Library Manager' dialog: From MSDN: "The Help Library Manager (HLM) application allows you to manage product documentation in the local Microsoft Help 3.0 content store. Using HLM, you can find and install new content from the web or from media, go online to get updates for your of ... [ read more ]


 Silverlight 3 applications can be installed as local applications on PCs and MACs. This is a brief 'how to' for enabling, installing, and removing a Silverlight 3 out of browser applications. 1. Use Visual Studio 2008 or 2010 to create a Silverlight 3 project. 2. Open the Silverlight 3 project's properties dialog. Select the 'Silverlight' tab. Check the 'Enable running application out of the browser'. Click the 'Out-of-Browser ... [ read more ]


 Read all about it at:  Final Stretch


The Visual Basic My.Computer.FileSystem GetFiles method can be used to search for files with a specific extension in or below a specific directory: Below is a function for that purpose: ...( read more )


Download source code here ->  Validation and the Windows Forms ErrorProvider Component I've noticed that not a lot of people take advantage of the Windows Forms built in user interface for indicating that a control on a form has an error associated with it - the ErrorProvider component. The ErrorProvider presents a simple mechanism for indicating to the end user that a control on a form has an error associated with it. If an error description string is specified ... [ read more ]


 Nullable types were a welcome addition to Visual Basic 2008.  In Visual Basic 2010 you can use them as parameters.  Here are two examples:     ' Assign Nothing as the default value for nullable optional parameter.     Sub Add( ByVal x As Integer , ByVal y As Integer , Optional ByVal z As Integer ? = Nothing )         ' code removed for brevity     ... [ read more ]


Visual Basic 2010 array litererals provide a shortcut mechanism for declaring and filling arrays for types that can be inferred by the compiler. Here a three examples: ' Examples Dim a = {1, 2, 3} 'infers Integer() Dim b = {1, 2, 3.5} 'infers Double() Dim c = {"1", "2", "3"} 'infers String() Becareful not to mix in types the compiler can not infer: ' WARNING: Make sure you used types that can be in ... [ read more ]


A multiline Function lambda is a lambda expression that represents a Function containing one or more statements. The “Function” keyword can be used to create a multiline lambda that returns a value. The following examples how to create mutiline Function lambdas. The first creates a multiline Function lambda and assigns it to a variable. The second uses a multiline Function lamda inline. ...( read more )


A multiline Sub lambda is a lambda expression that represents a Sub containing one or more statements. Visual Basic 9.0 only supported lambdas that were a single expression that returned a value; for example, the following line was an error: 'Error - Console.WriteLine doesn't return a value Array.ForEach(nums, Function(n) Console.WriteLine(n)) With Visual Basic 10.0, lambdas can now contain expressions that do not return a value: ...( read more )


Visual Basic 2010 provides mechanisms to continue lines of a statment without the traditional _ (underline) character. One mechanism is to contiue the statement on a new line after a comma...... ...( read more )


The transact SQL 'CASE' expression is useful for a lot of things but did you know you can use it to sort your query results in special ways? Here's a simple example......( read more )


The .Net String class' ToUpper function can be used with Visual Basic code for case insensitve comparrisons. Here's an example:...( read more )


This blog post provides an example that shows how to use the VisualBasic TextFieldParser class to read in data from a comma delimited files....( read more )


There are many ways to combine the Visual Basic My feature with LINQ.  Heres an example that gets a list the ports on a computer:   Dim portsList As List( Of String ) = ( From p In My .Computer.Ports.SerialPortNames Select p).ToList()


This post explains how to implement Visual Basic "Like" behavior in Linq To Sql queries. The Visual Basic Like operator has been around for a long time. I really like the simplicity of using the Visual Basic.Net Like Operator for string pattern matching.  For example, its simple to check to see if a string matches a U.S. social security number pattern like this:     Private Function SSNMatch( ByVal value As String )         Return If (value ... [ read more ]


  Here's an example showing how to count the occurrences of a character in a string:           Dim searchString As String = "This is the dawning of the age."         Dim count As Integer = ( From s In searchString.ToCharArray Where s = "i" Select s).Count  


Auto-implemented properties are a time saving feature that is new in Visual Basic 2010 - a short-cut for creating class properties. Auto-implemented properties enable you to declare a class property in a way that leaves it up to Visual Studio to create a private backing field and the Get and Set parts of the property for you. For example, when you type the following into the Visual Basic 2010 code editor: Property CustomerId() As Integer ...( read more )


Next time you think you need a control array consider using a generic list and LINQ instead....( read more )


The .Net Framework's DateTime 'TimeOfDay' method can be used to determine if two or more times are equal.         ' Create three DateTime objects to experiment with.         Dim date1 As New DateTime(2009, 9, 2, 9, 0, 0)         Dim date2 As New DateTime(2009, 9, 1, 9, 0, 0)         Dim date3 As New DateTime(2009, 9, 2, 10, 0, 0)         ' Test TimeOfDay equality between date1 and date2.         '    Even though the date is diffe ... [ read more ]
Visual Basic 2010 includes a feature for generating code from usage. The Generate From Usage feature enables you to use classes and members before you define them. You can generate a stub for any class, constructor, method, property, field, or enum that you want to use but have not yet defined. You can generate new types and members without leaving your current location in code. This minimizes interruption to your workflow. ...( read more )


 I blogged about Visual Basic 2010 collection intializers in a previous blog here -> Collection Initializers Here's another example using an alternative syntax: Public Class Form1     Private Sub Form1_Load( ByVal sender As Object , ByVal e As System. EventArgs ) Handles Me .Load         '   Use a collection initializer to load a List(Of Customer)     & ... [ read more ]


When I looked for examples for setting a ReportViewer control's Report and Linq DataSource at runtime I found most included many more steps than necessary. Here's a short and sweet VB example         ' Instantiate a DataContext that contains a table named "Activity"         Dim appData As New AppDataDataContext         ' Create a Linq query         Dim query = From a In appData.Activities Select a         ' Set the ReportV ... [ read more ]


The toolkit, for those of us who use PHP, makes it easier to use PHP to access ADO.NET Data Services, a set of features recently added to the .NET Framework. ADO.NET Data Services offer a simple way to expose any sort of data in a RESTful way. The PHP Toolkit for ADO.NET Data Services is an open source project funded by Microsoft and developed by Persistent Systems Ltd. and is available today on Codeplex: phpdataservices.codeplex.com


 I think this is a good short video for learning the basics of using the Silverlight Grid in Microsoft Expression: Microsoft Blend Expression - Using Grids


 Here's a function that retrieves a value from a pages query string; includes validation.     Private Function GetQueryStringValue( ByVal key As String ) As String         ' Get the document's QueryString Dictionary         Dim documentQueryString = CType (System.Windows.Browser.HtmlPage.Document.QueryString, System.Collections.Generic.Dictionary( Of String , String ))   ... [ read more ]


 Right-click the Windows 7 task bar and select Properties. Click the Customize button on the Properties dialog to open the Customize Start Menu dialog. Set System Administrative tool as shown in the image of the Customize Start Menu dialog shown below.    


Being a Microsoft MSDN subscriber I was able to download the the final "golden" bits of Windows 7.  I upgraded one of my development computers from Vista Ultimate to Windows 7 Ultimate (x86). The computer is an AZUS C90OS with 2 GB RAM and a 150 GB hard drive. Before I started the upgrade I uninstalled Visual Studio 2010 Beta 1 and Microsoft.Net 4 Beta 1.  To learn why see Scott Hanselman's post:   Vista Users - Uninstall Vi ... [ read more ]
 Last week I presented Visual Basic 2010 to 24 defense contract programmers who are using Visual Basic 2005. They were very pleased by what they saw and I can see why. In comparing 2005 with 2010 with the group it made me realize just how much Visual Basic.Net has improved. Looking back at 2005 was like taking a trip to the past. Have you checked out Visual Studio 2010 yet?  A well behaved Beta 1 is available at: Visual Studio 2010 Beta 1  


I've decided to stop blogging about Silverlight 2 and start blogging about Silverlight 3. I think it makes more sense to blog about Silverlight 3 now. Since I started posting about getting started with Silverlight 2, Silverlight 3 has been released. It also seems to make more sense to blog about Silverlight techniques I'm using in real world projects rather than blog about how to get started.  There are many excellent tutorials, blogs, and boo ... [ read more ]
LINQ to SQL translates LINQ queries to SQL for execution on a database. The results are strongly typed IEnumerable . Because these objects are ordinary common language runtime (CLR) objects, ordinary object data binding can be used to display the results. On the other hand, sorting and change operations (inserts, updates, and deletes) require additional steps. For example, to provide a DataSource for a DataGridView that can be sorted using the DataGridView's b ... [ read more ]


 Long time Visual Basic and .Net expert Deborah Kurata started blogging! Deborahs Developer Mindscape


Dissecting Hello World! This blog dissects the Silverlight 2 Hello World! application created in this previous blog: Silverlight Blog Post 2 - Hello World! Below is a screen shot of the Visual Studio 2008 Solution Explorer for the Hello World! solution.  Following it is an explanation of items 1-6, some of the more important parts of the solution. The solution consists of two Visual Studio projects: 1) HelloWorld the Silverlight 2 application project and 2) HelloWorld. ... [ read more ]


  Source Code: Silverlight 2 Blog Post 2 - Hello World   Silverlight 2 Blog Post 2 - Hello World   This post describes how to use Visual Studio 2008 SP1 to create a Silverlight 'Hello World' application. 1. If you have not done so already, install the Silverlight 2 browser plug-in at:  http://www.microsoft.com/silverlight/resources/install.aspx 2. If you have not done so already, install the "Microsoft® Silverlight&tr ... [ read more ]


This is the first in a blog series about developing Microsoft Silverlight 2 applications.  As of this post, Silverlight 2 is the latest release of Silverlight. A beta version of Silverlight 3.0 is available but keep this in mind: if you install the Silverlight 3 beta on your development computer in a non virtual space you will no longer be able to develop Silverlight version 2 applications.  If you would like to develop for both versions of Silverlight on the same computer set ... [ read more ]


  Source Code: Country ListView From .NET Globalization Namespace   Country ListView From .NET Globalization Namespace   This code demonstrates how to use the CultureInfo and RegionInfo classes from the .NET Globalization namespace to create a SortedDictionary list that can be bound to a ComboBox or DropDownList.   Visual Basic 2005   Imports System.Collections.Generic Imports System.Globalization   Public Class Co ... [ read more ]


  Source Code: Create Word 2003 Documents with .NET   Create Word 2003 Documents with .NET   While Microsoft Office Word 2003 still relies on VBA and COM, it can be automated in .NET code via .NET and COM interoperability. This allows you to create more powerful applications by integrating the many functions available in the Word products into your application. The sample code in the attached projects demonstrates how to do the following: Create a Word applic ... [ read more ]


 In Visual Studio 2008 you can export your toolbox customizations from Inport/Export Settings wizard. Toolbox is under general settings.


Your problem is likely the result of the Copy to output directory property on the database. The Copy to output directory property controls when your database is copied when debugging your application. By default, the database is copied to the output directory every time you debug (F5) your application.  This means you will never see the results of the last debug session because inserts, updates, and deletes are made to the copy in the output directory and the next time you deb ... [ read more ]
C# and VB Source Code: Edit Mode Strategy using a Windows Forms GroupBox Control Edit Mode Strategy using a Windows Forms GroupBox Control An edit mode strategy is a strategy for enabling and disabling data editing controls on an application form. The Windows Form GroupBox control is a container control; it can be used to logically group a collection of controls on a form. This solution demonstrates how to use a GroupBox to switch between editing allowed and editing not a ... [ read more ]


In the latest releases of the Silverlight Toolkit are available and include VB source code. The Silverlight Toolkit March 2009 release is enhanced with Visual Basic source code for both Silverlight 2 and Silverlight 3 . The Toolkit is a collection of controls, components and utilities made available outside the normal Silverlight release cycle. It includes full source code, unit tests, samples and documentation for 18 new controls covering charting, styling, layout, and user input, ... [ read more ]


The Microsoft Patterns and Practices Developer Center has released the Composite Application Block for WFP and Silverlight. The Composite Client Application Guidance is designed to help you more easily build modularWindows Presentation Foundation (WPF) and Silverlight client applications. These types of applications typically feature multiple screens, rich, flexible user interaction and data visualization, and role-determined behavior. They are "built to last" and "built for ... [ read more ]


The Visual Basic 2008 conditional If operator tests an expression and returns a value using short-circuit evaluation to conditionally return one of two values. Unlike the IIF runtime function the conditional If operator only evaluates its operands if necessary. In the code below , If(divisor <> 0, number \ divisor, 0) ,will not throw an exception if the value of number is 0.         Dim number As Integer = 10 ... [ read more ]


Useful Links for the New Internet Explorer 8...( read more )


            // Fill the Customer table that is part of the AjaxDataSet             AjaxDataSetTableAdapters. CustomerTableAdapter customerTableAdapter = new LINQ_To_MSAccess_CS2008.AjaxDataSetTableAdapters. CustomerTableAdapter ();             customerTableAdapter.Fill(ajaxDataSet.Customer);             // Use Linq to DataSet to query the Customer table.             var customerQuery = from c in ajaxDataSet.Customer.AsEnumerable() select c;             for ... [ read more ]


While researching commonly used screen resolutions for a development project, a fellow Microsoft MVP sent me the link to StatOwl . Thanks Antonio! This site is becomming a good place for developers to go when they have questions about what audiences, software, hardware, and more to target. The information offered on this site provides insight into Internet usage trends including browsers, operating systems, system settings, and much more.   


How can documents configured to open with a VB.NET Win Forms application (VB.NET 2005 and newer) - when double-clicked - be opened by a single instance of the application? The instructions below explain how to make an application a single instance application and how to open documents with a file extension of .az in a single instance of the application. The instructions assume that the .az file extension has already been associated with the applicati ... [ read more ]


This free tool from Microsoft Gold Certified 'UniBlue' makes it dirt simple to get information about processes running on your computer. After installation a green icon is shown to the left of each process in Task Manager. Click an icon to access UniBlue's process page. Get this tool -> http://www.processlibrary.com/quicklink/ mike mcintyre    GetDotNetCode  


Programming Entity Framework Julie Lerman is very excited to share with fellow MVPs that her book, Programming Entity Framework, has finally hit the shelves. The book spans a lot of topics from baby steps of creating a model, to querying to architecting n-tier apps with lots of plumbing on the way. All code samples are in VB and C#. " Programming Entity Framework is a thorough introduction to Microsoft's new core framework for modeling and interacting with data in .NET appl ... [ read more ]


 A post on vbCity asking how to get the lines in a VB6 multiline TextBox reminded me how much I like using VB.NET. In VB.NET 2005 its this easy: Dim multilineStrings() As String = Me .MyMultilineTextBox.Lines In VB.NET 2008, you can use LINQ too:  


Lambdas make it easy to query Generic Lists.  Here's a simple example that uses the Lambda Where() function to query a List(Of Integer): Public Class GetDotNetCodeSamples       Private integersList As New List( Of Integer )       Public Sub New ()         Dim numbers() As Integer = {5, 4, 1, 3, 9, 8, 6, 7, 2, 0}         ... [ read more ]


The new dynamic feature in Visual Basic 2010 let's you mix late-bound code in with statically typed code ie. you combine early and late binding in the same code. The dynamic feature uses the Dynamic Language Runtime (DLR) for caching and dynamic dispatch which enables interop with dynamic objects. The example below demonstrates how you would use an IronPython runtime to interop with with IronPython objects. Note the code example below will not work with t ... [ read more ]


Here's another way Visual Basic 2010 makes it easier to program: Array Literals    The Visual Basic compiler is smart enough to recognize when an array literal is composed of elements of the same type e.g. it 'infers' an array of integer in the first line of code above.  


Auto-implemented properties, new in Visual Basic 2010, provide a one-line way to declare a simple property with a backing field and a getter and a setter: Public Class Customer     Property CustomerID As Integer     Property CustomerName As String End Class   The compiler generates a backing field with the same name as the property, but with a preceding underscore.   Notice in the example ... [ read more ]


Before Visual Studio 2010, I've not liked fiddling with client side IDs in ASP.NET, especially when web page element is nested in another element. For example, this markup that is part of a user web control sets ClientID to 'CustomerChoice'. <asp:DropDownList ID="ddlCustomers" ClientID="CustomerChoice" runat="server">     <asp:ListItem>Jason</asp:ListItem>     <asp:ListItem>Jack</asp:L ... [ read more ]


Though its been available for several years, not everyone knows about Microsoft's 'Internet Explorer Developer Toolbar' for web developers. The toolbar makes it easy to explore a web page's markup, attributes, styles, and more.  You can check the pages you create to debug and tweak them.  You can examine pages from the web to discover new techniques.  The screen shot below shows a typical use for the toolbar. The toolbar is shown at the bottom of a w ... [ read more ]


Case statements can be used to return columns of data created from logic.  The example below shows how a CustomerType column can be returned that types customers as either 'International' or 'Domestic' depending on whether the 'Country' column in a customers table contains 'USA' or not. But what if the results need to be ordered by a column created by CASE WHEN logic? Just use the CASE statement in the ORDER BY clause. The query example below ... [ read more ]


 Being a huge Visual Studio snippets fan and doing a lot of web development,  I really like this Visual Studio 2010 feature for web developers:   snippets in markup! WIth this feature you can insert built in Asp.Net and JavaScript snippets.  You can create your own libraries of snippets and insert them too.


In the slide below language features in white text are being added to the language:  


The .NET Framework 4.0 provides  memory-mapped file API via its System.IO.MemoryMappedFiles namespace. System.IO.MemoryMappedFiles exposes Windows memory mapping functionality as first-class managed APIs.  I'm already imagining what I want to do with this .NET 4.0 namespace - "lazy loading" bits of a large file into memory, more efficient I/O, and creating shared memory for inter-process communication.  ... [ read more ]
 Though I've used Windows Vista for over two years I just got around to exploring its 'Windows Calendar'. Windows Calendar can be accessed fvia Start -> All Programs -> Windwos Calendar It supports the iCalendar format.  It can publish and subscribe to web-based calendars using HTTP and WebDAV, and to network drive web shares. It's a nice feature Microsoft bundled up with Vista.


The .NET 4.0 Framework provides addtional core data structures. One is  ComplexNumber Complex numbers are used in many different fields including applications in engineering, electromagnetism, quantum physics, applied mathematics, and chaos theory.   This Wikipedia article does a much better job of explaining complext numbers that I can in this post:  Complex Numbers        


SQL Server versions prior to 2008 did not provide Date and Time data types.  Below is a solution for SQL Server 2005 and 2000 that will strip time off a DateTime data type value. SELECT DATEADD ( DAY , DATEDIFF ( DAY , 0 ,[ DateTime] ), 0 )   Example Use   -- Create a variable of type DATETIME and store a date and time it it. DECLARE @DateWithTime DATETIME DECLARE @DateWithoutTime DATETIME   ... [ read more ]


The .NET 4.0 Framework provides addtional core data structures. One is  BigInteger BigInteger - The  BigInteger data type is supported where integer values are supported. However, BigInteger is intended for special cases where the integer values may exceed the range supported by the  System.Int32 data type (int in C#, Integer in VB).  


One puzzle SQL developers face from time to time is creating a calendar containing a series of days. Below is some SQL code that will create an in-memory calendar for every day from a begin date to an end date. By adding more columns to the #Calendar table you could store more information about each day, store hours and pay rate to do pay calculations, or other data you need to capture and process in a series of days. The example creates a calendar for 2009.  Happy New Year! ... [ read more ]


VIsual Basic contains some useful functions not available in the .NET class library. This post is about one of those functions, the Join(string array,string delimiter) function. The Join function concatenates an array of strings into a delimited string using a specified delimiter. Here is a method that includes the Join function:     Private Function GetDelimitedString( ByVal strings As String (), ByVal delimiter As String ) As String  & ... [ read more ]


Extension methods are new in Visual Basic 2008.  This short blog series explores how extension methods can be used to add Subs and Functions to the .NET String type. Click here for an index of this blog series. Here's this post's sample code: Module StringExtensions     ' Declare a String extension method named Browse     '   that uses the string assigned to a variable of type String as a url  & ... [ read more ]


VIsual Basic contains some useful functions not available in the .NET class library. This post is about one of those functions, the Right(str,length) function. The Visual Basic 'Right' function is useful when you need to get 1 or more characters from the right side of a string. It returns a string containing a specified number of characters from the right side of a string. Syntax:  Right(str,length) Parameters str Required. String expression from ... [ read more ]


I recently had a task to create code to calculate an annuity payment. Visual Basic has a builit in function - Pmt - for this purpose. Here's a method I created that calculates an annuity payment with Visua Basic's Pmt function: Public Function CalculateAnnuityPayment( ByVal rate As Double , _         ByVal paymentPeriods As Double , _         ByVal presentValue As ... [ read more ]


ANTS Profiler version 4.0, released September 2008, adds many new features to this already powerful .NET profiling product. Web: www.red-gate.com Phone: +1 866.733.4283 Price: $395/$495 Pro Quick Facts: ANTS Profiler is a tool for profiling applications written in any of the languages supported by the .NET framework. ANTS Profiler profiles all .NET applications, including ASP.NET web applications, Windows Services and COM+ applications. This is the third time ... [ read more ]


 Extension methods are new in Visual Basic 2008.  This short blog series explores how extension methods can be used to add Subs and Functions to the .NET String type. Click here for an index of this blog series. Here's this post's sample code: Module StringExtensions     ' Declare a String extension method named Browse     '   that uses the string assigned to a variable of type String as a url &nb ... [ read more ]


Extension methods are new in Visual Basic 2008.  This short blog series will explore how extension methods can be used to add Subs and Functions to the .NET String type. Click here for an index of this blog series. Try this: 1. Create a Visual Basic 2008 Windows Forms project. 2. Add a module named StringExtensions to a Visual Basic 2008 Windows Forms project:     2. To Form1 in the project add a form load handler based on this sample code: P ... [ read more ]
 When I first published this list on my .Net Resources blog October 2007, it contained eleven books. The list has grown so large that I am now hosting it on my Get Dot Net Code web site: Visual Studio 2008 Books


"The Silverlight Toolkit is a collection of Silverlight controls, components and utilities made available outside the normal Silverlight release cycle. It adds new functionality quickly for designers and developers, and provides the community an efficient way to help shape product development by contributing ideas and bug reports. This first release includes full source code, unit tests, samples and documentation for 12 new controls covering charting, styling, layout, and user input." ... [ read more ]


I've been thinking a lot lately about the difference between software construction and software remodeling, and how agile software development must vary for construction vs. remodeling.  Software construction is building version 1 of a software or system. Software remodeling is maintaining, refactoring, or adding features to an already constructed software application or system. (For brevity I will refer to a sofware application or system as jus ... [ read more ]


Visual Basic 2008 introduces anonymous types which enable you to create an object without declaring its data type.  Notice in the anonoymous type declaration below that there is no 'As' in the declaration to specify a type for the object it will create. user = New With {.FirstName = "Mike" , .LastName = "McIntyre" , .City = "Cobb" } When the declaration is compiled, the compile ... [ read more ]


Collection initializers will let you initialize collections with fewer lines of code. In the two examples below notice the use of 'From' to initial collections from lists. Dim colorList As New List(Of String) From {"Red", "Blue", "Green","Black"}  Dim statusDictionary As New Dictionary(Of String, Integer) From {{"Aproved", 1}, {"Disapped", 2},{"Needs More Info", ... [ read more ]
Access previous posts at:  http://blogs.vbcity.com/mcintyre/
My .Net Journal blog posts will be made to the new vbCity blog site from now on. Here's the link to my new blog site:  Mike McIntyre's .NET Journal RSS feed is:  http://cs.vbcity.com/blogs/mike-mcintyre/rss.aspx  


My makes it easy to use .Net. Here's an example that uses My to rename a file: Syntax: Public Shared Sub RenameFile ( _     file As String , _     newName As String _ ) file is the file path to the file to be renamed. newName is the new name (with file extentsion) to be given to the file. Example: My .Computer.FileSystem.RenameFile( "C:\OldName.txt" , "NewName.txt" )   Mike McIntyre Get Dot Net Code ... [ read more ]


The Silverlight team has Visual Basic How-Do-I videos, and all the code downloads are now equally available in VB and C#.   Silverlight Visual Basic How-Do-I Videos 


  Example:   ' Create a LINQ query.         Dim textBoxQuery = From control In Me .Controls Where TypeOf (control) Is TextField         ' Create a list of object.         Dim textBoxList = textBoxQuery.ToList         ' Iterate through the objects in textBoxList. &nbs ... [ read more ]


Check it out:  Goto100


Relaxed delegate conversion, introduced in Visual Basic 2008, enables you to assign subs and functions to delegates or handlers even when the signatures are not identical. Therefore, binding to delegates becomes consistent with the binding already allowed in method invocations.  In Visual Basic prior to 2008: Sub OnClick (ByVal sender As Object, ByVal e As EventArgs) Handles RunButton.Click     MessageBox.Show("Visual Basic prior to VB 2008") End Sub ... [ read more ]


Jaren Parsons of the Microsoft Visual Basic Team created PInvoke Interop Assistant . In a blog announcing the tool he says: “The motivation behind this tool is writing PInvoke is a hard and often tedious task. There are many rules you must obey and many exceptions that must be taken into account.” Read about the tool and get a link to download it at: Making PInvoke Easy


The list has more than doubled since I first published it here . Below, in alphabetical order, is a partial listing of Visual Basic 2008 books.  Some have already been published, some will be published over the next several months. Accelerated VB 2008 (Accelerated)   Beginning ASP.NET 3.5 in VB 2008 - Programming Techniques   Beginning VB 2008 Databases: From Novice to Professional   Beginning Microsoft Visual Basic 2008 ... [ read more ]


Local type inference is an important new concept to grasp as one approaches Visual Basic 2008.  Many new features in VB 2008 are dependent on it. Below is a brief introduction to local type inference followed by a link to a MSDN resource where you can learn more. Introduction In Visual Basic 2008 you can get strongly typed local variables without using the 'As' clause to explictly set the variables type.  Here is an example of declaring a strongly t ... [ read more ]


Get it at: Free eBook Offer Visual Studio 2008 Preview the first chapter from any of these Microsoft Press Visual Studio 2008 titles. When you're ready, sign up for the free download offer to get additional content.


For more VB XNA game code visit:  http://ilovevb.net/Web/ Checkout the downloads section.


I am a professional business application developer, not a game developer.  My programming language of choice is Visual Basic, through I am proficient with and have developed applications with many languages such as C, C++, SmallTalk, Java, and C#. I recently received a very important project request. Though it a request to develop a game, I couldn't turn it down. My grandson wants me to help him develop a computer game. As a Microsoft MVP I am painfully aware that Mic ... [ read more ]
 Below, in no particular order, is a partial listing of Visual Basic 2008 books.  Some have already been published, some will be published over the next several months. Microsoft Visual Basic 2008 Step by Step http://www.microsoft.com/MSPress/books/12202.aspx   Amazon.com: Visual Basic 2008 For Dummies http://www.amazon.com/Visual-Basic-2008-Dummies-Computer/dp/0470182385   Amazon.com: Accelerated VB 2008 (Accelerated) http://www.amazon.com/Ac ... [ read more ]


Do you get frustrated trying to add graphics to you .NET Windows Forms applications? Learning to use the .NET graphics classes is not easy. Managing the graphics you create with the classes increases the amount of code you need to write. There was a line and shape control for creating graphics in Visual Basic before .NET. It was widely used by developers to easily decorate the Windows Forms they created with graphics. It was easy to use. The line and shape control was missing-in-acti ... [ read more ]


Below are some of the links I have found useful for learning about, and developing with, the Microsoft Silverlight technologies.  As a Visual Basic programmer you may want to start learning what Silverlight development is all about. Because Visual Basic in .NET can be used as a static or dynamic language, there are some unique opportunities emerging in Silverlight development for Visual Basic programmers.   Microsoft Silverlight (WikiPedia) A ... [ read more ]
What's the middle ground between OPTION STRICT ON and OPTION STRICT OFF ? Jonathan Aneja  of the Microsoft Visual Basic team explains in his recent blog:   Option Strict [On|Off|SortOf]  


If you are a Visual Basic for .NET programmer who has tried to extend Visual Studio in the past, here's some really good news: The Visual Basic Pack for Visual Studio 2005 SDK download provides the SDK samples converted in the Visual Basic language and a new wizard that is used for generating Visual Basic based integration Packages for Microsoft Visual Studio. This download is an add-on to version 4.0 of the Visual Studio 2005 SDK . While VB support for the ... [ read more ]
.NSFinalReport { FONT-WEIGHT: normal; FONT-SIZE: 8pt; FONT-FAMILY: Tahoma, Verdana, Arial } .NSTOC { FONT-WEIGHT: normal; FONT-SIZE: 10pt; FONT-FAMILY: Verdana } What is Microsoft Expression Studio?   When I make web design presentations lately I get more and more folks asking "What is Microsoft Expression Studio?", so I went looking on the web for some good resources that explain the studio and the applications in it. What follows ... [ read more ]


Note: This article is based on Orcas Beta 2 (Visual Studio 2008).   Extension Methods Visual Basic 2008 extension methods enable you to "add" functionality to existing types without creating a new derived type. Types That Can Be Extended · Classes (reference types) · Structures (value types) · Interfaces · Delegates · ByRef and ByVal arguments ... [ read more ]


Source Code: How to Create Microsoft Access DataSource for Win Forms App Visual Basic 2005 How to Create Microsoft Access DataSource for Win Forms App Visual Basic 2005 Visual Studio 2005 provides a feature, the 'Data Source Configuration Wizard', for creating a DataSource for a Windows Forms 2.0 application. This article provides step-by-step instructions and a sample Visual Basic 2005 application you can use to learn how make a Microsoft Access database the data source for a V ... [ read more ]
MSDN has had a face lift. Visual Basic Development Center For an explanation of the search and navigation imporovements visit: Search and Navigation Improvements on MSDN


Source Code: Build an ASP.NET 2.0 Web Site Navigation System Pt3 Build an ASP.NET 2.0 Web Site Navigation System Pt3 This is part three of a three part article that demonstrates how to build an ASP.NET navigation system. In part one, web pages were added to a web site and then referenced in a ASP.NET 2.0 SiteMap file. In part two an ASP.NET 2.0 Menu control was tied to the SiteMap file created in part one. In part three an ASP.NET SiteMapPath (bread cr ... [ read more ]


The Visual Basic team has put together a "Live from Redmond " webcast series aimed at the next version of Visual Basic and Visual Studio code named "Orcas".   The live series starts April 18th and will continue to the end of May.   Learn more -> VB Orcas Live From Redmond Series


Source Code: ADO.NET 2.0 The Series - Part One ADO.NET 2.0 The Series - Part One This is part one of a multi-part article about ADO.NET 2.0. Part one introduces the ADO.NET 2.0 Object Model and provides source code which implements the ADO.NET Connection, Command, and Reader objects using the System.Data.SqlClient data provider. The source code .zip file included with part one contains: Visual Basic 2005 Windows Forms Application C# 2005 Windows Forms Application ... [ read more ]


Source Code: How To Group ListView Items with ListViewGroup VB2005 How To Group ListView Items with ListViewGroup VB2005 This article with source code demonstrates how to group ListView Items with the ListViewGroup class and Visual Basic 2005. In the article example, customers are loaded from a database and three groups are created - customer name, region, and country. Example Application Screen Shot About the ListView Grouping ListView grouping is use ... [ read more ]


Source Code: Build an ASP.NET 2.0 Web Site Navigation System Pt2 Build an ASP.NET 2.0 Web Site Navigation System Part 2 This is part two of a three part article that demonstrates how to build an ASP.NET navigation system. In part one, web pages were added to a web site and then referenced in a ASP.NET 2.0 SiteMap file. In part two an ASP.NET 2.0 Menu control will be tied to the SiteMap file created in part one. In part three an ASP.NET SiteMapPath (bread crumbs menu) will be ... [ read more ]


Source Code: DAL For MS Access Databases - Part 6 DAL For MS Access Databases - Part 6 Previous parts of this article can be read at:  Part 1 , Part 2 , Part 3 , Part 4 , Part 5 Part five of this article demonstrated how to 1) create a custom BindingSource class; 2) bind a custom BindingSource class to a DataGridView; 3) extend a TableAdapter by adding queries to it; and 4) modify and/or extend a TableAdapter via its partial class. Part six provides ... [ read more ]


Source Code: How To Use Lazy Initialization VB.NET and Visual Basic 2005 Pt2 How To Use Lazy Initialization VB.NET and Visual Basic 2005 Part Two This is part two of a two part article and source code which explains the lazy initialization pattern and how to implement it in an order entry scenario with VB.NET and Visual Basic 2005. In object-oriented programming (OOP), lazy initialization is the strategy of improving application performance by delaying the creation of ... [ read more ]


Source Code: Build an ASP.NET 2.0 Web Site Navigation System Pt1 Build an ASP.NET 2.0 Web Site Navigation System Part 1 This is part one of a three part article that demonstrates how to build an ASP.NET navigation system. In part one, web pages are added to a web site and then referenced in a ASP.NET 2.0 SiteMap file. In part two an ASP.NET 2.0 Menu control will be tied to the SiteMap file created in part one. In part three an ASP.NET SiteMapPath (bread crumbs menu) will be ... [ read more ]


Source Code: How To Improve Performance with TryCast Keyword VB2005 How To Improve Performance with TryCast Keyword VB2005 The TryCast keyword, introduced in Visual Basic 2005, provides Visual Basic programmers with a new way to cast reference types. Unlike the CType and DirectCast keywords, if an attempt to convert with TryCast fails, TryCast will NOT throw an InvalidCastException error. This will improve the performance of your application. TryCast returns Nothing ... [ read more ]


Read about it here: ASP.NET AJAX 1.0 Released I'm excited.  After creating VB examples for Microsoft Ajax and updating them each time the CTP and RC were changed, I am looking forward to updating my examples with the actual release.  I also have dozens of new examples I would like to create now that Ajax 1.0 is released.
Source Code: How To Compare Two Files using HMACSHA1 with VB.NET or VB2005 How To Compare Two Files using HMACSHA1 with VB.NET or VB2005 This article is similar to the article How To Compare Two Files with VB.NET and VB2005 . The difference is this file comparison article and source code use the .NET System.Security.Cryptography HMACSHA1 Class to compare two files. The suggestion to use HMACSHA1 was made by reader Jim Parzych. In tests I conducted, the HMACSHA1 ... [ read more ]


Source Code: How To Compare Two Files with VB.NET and VB2005 How To Compare Two Files with VB.NET and VB2005 This article and source code demonstrate how to use Visual Basic 2005 to compare two files to determine if they are equal. This comparison looks at file paths, file lengths, and file contents. NOTE: While source code for VB.NET is not provided, the CompareFiles function included in this article will work with VB.NET too. Be sure to Import System.IO. Application ... [ read more ]


Source Code: How To Use Lazy Initialization with VB.NET and Visual Basic 2005 How To Use Lazy Initialization with VB.NET and Visual Basic 2005 This is part one of a two part article and source code which explains the lazy initialization pattern and how to implement it in an order entry scenario with VB.NET and Visual Basic 2005. In object-oriented programming (OOP), lazy initialization is the strategy of improving application performance by delaying the creation of an ... [ read more ]


Source Code: Expression List Variations Select..Case Statement VB 2002-2005 Expression List Variations Select..Case Statement VB 2002-2005 The Select...Case statement is used to execute one of several groups of statements, depending on the value of an expression. This article and source code reviews and demonstrates different possible ways to vary the expression list used to test the value of an expression in a Select...Case statement. Screen Shot of Sample Application ... [ read more ]


Source Code: How To Get and Set File Info with FileSystem Attributes VB2005 How To Get and Set File Info with FileSystem Attributes VB2005 This article and source code demonstrate how to use the .NET 2.0 FileInfo class' Attributes property and Visual Basic 2005 to get and set file info.   The Attributes property of the System.IO.FileInfo class is used to get or set file attributes. For example, you can determine if a file is read-only, make a file read-only, or make ... [ read more ]
When you use a BindingSource, for example by dragging it on to a page to bind data to a DataGrid or BindingNavigator, you will eventually need to cast the object that is current in the BindingSource into a type you can use to read or edit it.  Typically code as shown below is used to cast the BindingSource's Current object to a strongly typed DataRow: Dim currentCustomer As DataService.AjaxDataSet.CustomerRow currentCustomer = CType ( CType ( Me .AjaxCustomerBindingS ... [ read more ]


Source Code: How To Browse Folders with FolderBrowserDialog and Visual Basic 2005 How To Browse Folders with FolderBrowserDialog and Visual Basic 2005 This article and source code demonstrate how to use the .NET Windows Forms FolderBrowserDialog class and Visual Basic 2005 to provide a way to prompt the user to browse, create, and eventually select a folder. Use this class when you only want to allow the user to select folders, not files.   Browsing of the folders is ... [ read more ]


Source Code: How to Add a Gradient Background to a Win Form with VB.NET & VB2005   How to Add a Gradient Background to a Win Form with VB.NET & VB2005 This article and two downloadable Visual Studio Visual Basic solutions provide code that overrides the Form OnPaint event to create beautiful gradient backgrounds for a Windows Form. Also included is code that optimizes form drawing. Form With Image and Gradient BackGround First, the code imports: I ... [ read more ]


Source Code: Multiple BindingNavigators on Same Windows Form VB 2005   Multiple BindingNavigators on Same Windows Form VB 2005 Visual Studio 2005 sometimes automatically adds a BindingNavigator for a BindingSource to a Windows form. For example, when you drag the first DataSource to a Windows form from the DataSource panel in Visual Studio 2005, a BindingNavigator control is automatically added to the Windows form. Result You must sometimes manual ... [ read more ]


Source Code: DAL For MS Access Databases - Part 5 DAL For MS Access Databases - Part 5 Previous parts of this article can be read at:  Part 1 , Part 2 , Part 3 , Part 4 Part four of this article demonstrated how to to centralize CRUD operations (create, retrieve, update, and delete database data) in a DAL component. In addition, part four of the article explained how to use Microsoft.NET 2.0 partial types to modify and extend the behavior of the D ... [ read more ]


Source Code: Generate Thumbnail Images with .NET Image Class and Visual Basic 2005 Generate Thumbnail Images with .NET Image Class and Visual Basic 2005 You can use the .NET 2.0 Image class' GetThumbnailImage method to generate a scaled thumbnail of an image. If the Image contains an embedded thumbnail image, this method retrieves the embedded thumbnail and scales it to the requested size. If the Image does not contain an embedded thumbnail image, this method creates a th ... [ read more ]


Source Code: Create 'Find' Form With Visual Basic 2005 and .NET Win Forms BindingSource Class Click the link above for a Visual Studio Windows Forms solution which demonstrates how to create a 'Find' Form with Visual Basic 2005 and the .NET Windows Forms 2.0 BindingSource class's Find method.


The Microsoft Visual Basic Power Packs team has just released the Microsoft Printer Compatibility Library 1.0. The Printer Compatibility library will help those migrating Visual Basic 6.0 projects to Visual Basic 2005.  Add a reference to this compatibility library and most Visual Basic 6.0 printing logic will continue to work just as as expected. Get it Here !
Source Code: Parse Tab Delimited Log Files With Visual Basic 2005 'My' Namespace Parse Tab Delimited Log Files With Visual Basic 2005 'My' Namespace Fields of data in log text files is often tab delimited. To access the fields of data in a tab delimited log file, or any tab delimited text file for that matter, the file must be parsed. Parsing a tab delimited text file is the process of transforming input text into a data structure, which is suitable for further processing and whi ... [ read more ]


Source Code: Microsoft AJAX Series Part 6 - PageRequestManager Microsoft AJAX Series Part 6 - PageRequestManager This is the sixth in a series of blog posts about Microsoft ASP.NET AJAX, a new web development technology from Microsoft. Click these links to view previous posts in this series: Post 1 , Post 2 , Post 3 , Post 4 and Post 5 This article introduces the Microsoft Ajax PageRequestManager object and demonstrates how to handle its pageLoaded event to it ... [ read more ]


Source Code: Draw Text with GDI+ and Visual Basic 2003 (Visual Basic.NET) Draw Text with GDI+ and Visual Basic 2003 (Visual Basic.NET) This article and source code demonstrate how to draw text with Visual Basic and the Microsoft.NET System.Drawing.Drawing2D and System.Drawing.Drawing2D namespaces. A Visual Studio 2003 Windows Forms application created with Visual Basic implements .NET drawing classes to draw text and apply the following effects: brush, shadow, emboss, b ... [ read more ]


Source Code: Count Occurences of Words and Terms in a String Count Occurences of Words and Terms in a String This article with source code shows how to create a class that can be used to count the occurrences of words and terms in a string.   There are many reasons to count the occurrences of words and terms in a string.   A page author may count the occurrences of words and terms in a web page to determine which words and terms search engines will recogn ... [ read more ]


Read Article and Download Source Code:  DAL For MS Access Databases - Part 4 This is the fourth part of a tutorial article I wrote to demonstrate how to create a data access layer (DAL) with .NET 2.0, ADO.NET 2.0, Visual Studio 2005, and Visual Basic 2005. Part four of the article explains how to centralize CRUD operations (create, retrieve, update, and delete database data) in the DAL component. In addition, part four of the article explains how to use Microsoft.NET 2. ... [ read more ]


Source Code:  Microsoft ASP.NET AJAX the Series Part 5 - Call Web Service With JavaScript This is the fifth in a series of blog posts about Microsoft ASP.NET AJAX, a new web development technology from Microsoft. Click these links to view previous posts in this series: Post 1 , Post 2 , Post 3 , and Post 4 This post introduces the Microsoft Ajax asynchronous communication layer and demonstrates how to use it to call a web service, from a client, using J ... [ read more ]


Can you use Visual Studio on Windows Vista to create applications for Windows Vista?  If so, which versions of Visual Studio are compatible with Windows Vista.?  What issues are you going to face? These are questions quite a few developers are facing now that Windows Vista has been released. Below are links to some resource that may help you get your hands around using Visual Studio with Windows Vista. MSDN Visual Studio on Windows Vista Support Page MSDN Wi ... [ read more ]


Source Code:  Data Access Layer (DAL) For MS Access Databases - Part 3   This is the third part of a tutorial article demonstrating how to create a data access layer (DAL) with .NET 2.0, ADO.NET 2.0, Visual Studio 2005, and Visual Basic 2005. Click these links to view previous posts in this series: Part 1   Part 2 In part two the DataService project's DAL component was extended and then used for the fist time by a Windows Forms application. Part t ... [ read more ]


Visual Basic and C# Source Code:   Microsoft ASP.NET AJAX the Series Part 4 - Nested UpdatePanels With Nested GridViews This is the fourth in a series of articles about Microsoft ASP.NET AJAX, a new web development technology from Microsoft. Click these links to view previous posts in this series: Post 1 , Post 2 , and Post 3    Partial  Page Rendering - Nested UpdatePanel Server Controls with GridViews Nesting Microsoft ASP.NET Ajax UpdatePanel co ... [ read more ]


Source Code:  Data Access Layer For Microsoft Access Databases - Part 2 This is the second part of a tutorial article which demonstrates how to create a data access layer (DAL) with .NET 2.0, ADO.NET 2.0, Visual Studio 2005, and Visual Basic 2005. To read part one click here . A basic data access layer component (DAL) for Microsoft Access databases was created in part one. In part two the DAL component will be extended and then used for the first time by a Windows F ... [ read more ]


  VB Source Code:      AJAXBeta2UpdatePanelNested_VB.zip C# Source Code:     AJAXBeta2UpdatePanelNested_CS.zip This is the third in a series of blog posts about Microsoft ASP.Net AJAX, a new web development technology from Microsoft. The first and second post in this series introduced Ajax technologies and Microsoft AJAX, and, in a 'Hello World' example, introduced the UpdatePanel server control. Nest UpdatePanel Co ... [ read more ]


Tutorial and Source Code:  Data Access Layer For Microsoft Access Databases This multi installment article will provide instructions and source code you can use to create a data access layer (DAL) for Microsoft Access databases. Along the way the article will explain when a DAL may be appropriate and some of the roles ADO.NET and Visual Studio data technologies can play in a DAL. This first installment provides instructions and a downloadable example that can be used to ... [ read more ]


Source Code:    Windows Forms Password Encryption Visual Basic 2005 This article and source code explain how to use the .NET Cryptography MD5CryptoServiceProvider method to encrypt a string used as a password in a Windows Forms application.   The .NET MD5CryptoServiceProvider computes the MD5 hash value for input data using the implementation provided by the cryptographic service provider.   Hash functions map binary strings of an arbitrary length ... [ read more ]


VB Source Code: Hello World ASP.NET AJAX Beta 2 - Visual Basic 2005 C# Source Code: Hello World ASP.NET AJAX Beta 2 - C# 2.0 This is the second in a series of blog posts about Microsoft ASP.Net AJAX, a new web development technology from Microsoft. The previous post in this series provided a definition of Ajax: A term used to refer to a group of technologies used, in various combinations, to create web applications that are more interactive and responsive, and which provide a ... [ read more ]


Source Code: Web Tab Control From Asp.Net MultiView, Menu, And View Controls This article and source code demonstrates a technique for creating the tabbed page interface ('TabControl') shown below for an ASP.NET 2.0 web page. The technique uses Visual Basic 2005, and the ASP.NET 2.0 MultiView, View, and Menu controls which are new in ASP.NET 2.0. See the markup in the 'Default.aspx' web page (in the source code). There you will see how the Menu control, MultiView control, ... [ read more ]
This is the first in a series of blog posts about ASP.Net AJAX, a new web development technology from Microsoft. A series about ASP.Net AJAX must start by first answering the question: "What is Ajax?" Ajax is a term used to refer to a group of technologies used, in various combinations, to create web applications that are more interactive and responsive, and which provide a richer client-side experience , than what is found in classic web applications.   Ajax Techn ... [ read more ]


If you had a magic wand and could create the perfect VB book for .NET , what would it be like? Are there  books missing from the current Visual Basic .NET book offerings? If you could tell the .NET authors out there what you would like to see in a book for Visual Basic in .NET, what would you tell them? Dirt Simple? One-Step-At -A-Time? Advanced? Very advanced? Books that focus on using Visual Basic with particular .NET technologies e.g. Generics, ... [ read more ]


It's never been easier to learn how to program with Visual Basic. Listed below are a bakers dozen of links to free getting started tutorials for Visual Basic 2005. What's a baker's dozen?  To find out click here -> Baker's Dozen Visual Basic 2005 Learning Resources Dan Mabbutt's Learn Visual Basic with VB.NET 2005   This course is a complete, free, newsletter based course to help beginning programmers get up to speed. No textbook is ... [ read more ]


Source Code:  Get Data from Double-Clicked DataGridView Row This article and source code demonstrates how to retrieve the data bound to a Windows Forms DataGridView control row when a user double-clicks a row header. The approach in this article assumes a scenario where a DataSource has been bound to DataGridView. The DataGridView control raises the RowHeaderMouseDoubleClick when a user double-clicks a row header. By adding a handler for the RowHeaderMouseDoubleClick e ... [ read more ]


Source Code:   Ajax Beta 1 Call Web Service With JavaScript The Visual Basic source code provided by the Ajax v1.0 Beta article at How To: Call a Web Service from JavaScript is actually written with C#.  The web service (CallWebService.asmx) is written in C#, the web page (CallWebService.aspx) includes a method 'EchoString' that is written in C#. The source code provided with this post is a Visual Basic version. Click the link above to download Visual Basic so ... [ read more ]


Source Code:   Color DataGridView Cells Based On Data This blog, and the source code it provides, demonstrate how to handle the Windows Forms DataGridView CellFormatting event to set the BackColor of a cell based on the cell's value. The example application in the source code provides users a way to mark inactive customers and/or customers who have not placed an order in the last 30 days. The CellFormatting event occurs when the contents of a cell in a Windows Forms DataGr ... [ read more ]


Tokenize a String   Source code that demonstrates how to extract, or 'tokenize', specific content from a string.... Determine if a String is Nothing or has a length of 0.   Source code that demonstrates how to use the .Net String class' IsNullOrEmpty method, new in .NET 2.0, to determine if a string is Null (has a value of Nothing) or Empty (length is 0).... Reverse a String   Source code ... [ read more ]


Source Code: Programmatically Load Web User Control At Runtime How can you programmatically load an ASP.NET 2.0 UserControl at runtime? First, the UserControl must be loaded using the LoadControl method. You must pass a string, that is the virtual path to the UserControl to be loaded, to the LoadControl method. The LoadControl method returns a control object. ' Declare a variable named controlToLoad of type Control. Dim controlToLoad As Control   ' Ca ... [ read more ]


Source File: Upload File to Server using ADO.Net SqlCommand This source code demonstrates how to use an ASP.NET web page to upload a binary large object (BLOB) and insert it, using a stored procedure, into a SQL Server table text type column.   Client-side a file is selected and submitted via an ASP.NET web page. Server-side, the web page processes the request by building an ADO.NET SqlCommand object that passes the file data to the SQL Server table via a st ... [ read more ]


Source Code: Parse Comma Delimited TextFile with Visual Basic 2005 TextFieldParser A common question in the Visual Basic forums on the Web is: "How do I parse a comma delimited file?". For those using Visual Basic 2005, a good solution is the new TextFieldParser class. The TextFieldParser class provides a way to parse structured text files. A TextFieldParser object can be used to read both delimited and fixed-width files. The code example below show how to parse a comma ... [ read more ]


Source Code: Create Simple Database From DataSet And XML File Visual Basic 2005 This article provides the steps necessary to create a simple database from a DataSet and an XML file. It will explain how to use a DataSet and an XML file to implement the database and how to perform CRUD (Create, Retrieve, Update, and Delete) operations on the data stored in the XML file. The source code uses the DataSet created in the tutorial located at Create Data Table And Columns With DataSet ... [ read more ]


Source Code:    Create Data Table And Columns With DataSet Designer Visual Basic 2005 This article provides the steps to manually create a stand-alone DataTable in a DataSet with the Visual Studio 2005 DataSet Designer. This article is a precursor to an article that will explain how to use a DataSet and an XML file to implement a simple database and how to perform CRUD (Create, Retrieve, Update, and Delete) operations on the data stored in the XML file. DataSets are ... [ read more ]


Download Source Code: Source Code Update: Cleaned up pages wide and pages tall calculation per suggestion from a reader. This article discusses how to print a multiple page image and provides sample code in a Visual Studio 2005 solution. The process involves calculating an array of rectangles where each rectangle defines a page size chunk of the image. The rectangles are then used to extract a page sized chunk from the image for each page to be printed. Code Example One ... [ read more ]


Download Source Code:   Manipulate the Registry with Visual Basic and the RegistryProxy Class RegistryProxy Class The RegistryProxy class, new in .NET 2.0, is a proxy class that can increase productivity when a developer is creating code to programmatically manipulate the registry. The RegistryProxy class provides properties and methods for manipulating the registry. The proxy pattern is used by the Visual Basic My feature to increase developer productivity. A prox ... [ read more ]


An excellent article on Web 2.0 can be found at -> What is Web 2.0?


Download Source Code:   Read XML Document with XPathNavigator The .NET 2.0 XmlNavigator class provides a cursor model for navigating and editing XML data. This short article and download provide an introduction to using the XPathNavigator to read XML documents. The download contains two examples: one that reads an XML document  that contains a default namespace and one that reads and XML document that does not contain a default namespace. An XPathNavigator obje ... [ read more ]


Dowload Source Code:   Source Code Use the Visual Basic 2005 My.Compuer.FileSystem. GetFiles method to search for files. The My.Computer.FileSystem.GetFiles Method returns a read-only collection of strings representing the name of the files within a directory. Use the wildCards parameter of the GetFiles method to specify a specific file name pattern. Set the searchType parameter of the GetFiles method to search only the root of a directory or a directory and all its s ... [ read more ]


Managed Stack Explorer is a free power tool from Microsoft that we have found to be very useful for profiling and debugging the Microsoft .NET 2.0 applications we and our clients create. Managed Stack Explorer is a lightweight tool used to monitor .NET 2.0 managed processes and their stacks. The Managed Stack Explorer provides a simple interface to allow you to monitor multiple processes at once and build periodic stack log files. Managed Stack Explorer works by quickly attaching to ... [ read more ]


The BackgroundWorker Class, new in .NET 2.0, makes threading your application operations easier. Use the BackgroundWorker class to create a BackgroundWorker object that can execute an operation on a separate thread. Processing on a separate thread makes it possible to maintain a responsive user interface while running a time consuming operation in the background. A BackgroundWorker object can be created programmatically or by dragging it onto a form from the Components tab of the Toolb ... [ read more ]


Accessing data has evolved in ASP.NET to include new controls such as the SqlDataSource control. The SqlDataSource class provides a FilterExpression property that can be used to filter the results of calling the SqlDataSource class' Select method. The code example that follows is all the code needed to drive a web page where a user can enter part or all of a last name to filter the rows of a GridView: Code Example Partial Class _Default     Inhe ... [ read more ]


The HtmlTitle and HtmlMeta classes, new in ASP.NET 2.0, provide a simpler way to programmatically manipulate the HTML tag in web forms applications. The HtmlTitle and HtmlMeta classes, new in ASP.NET 2.0, provide a simpler way to programmatically manipulate the HTML <head> tag in web forms applications. Use the HtmlTitle class to programmatically specify the HTML title element of a Web Forms page. The HtmlMeta control provides programmatic access to the HTML meta ... [ read more ]


The Stopwatch class provides a set of methods and properties that you can use to accurately measure elapsed time. Although its not a complete profiling solution it is very useful for things like quickly measuring code execution time. A Stopwatch instance can measure elapsed time for one interval, or the total of elapsed time across multiple intervals. Code Example Public Class MainForm       Private m_PersonsList As New List( Of Person)      ... [ read more ]


Microsoft has released the MSDN Library as a free public download. The Library is current as of May 2006, and will be updated with future versions for free download. Mike McIntyre Get Dot Net Code


EDIT: As someone pointed out my example was a bit sloppy so it has been edited. In Step One, the Person class has been changed to avoid the need to cast from object to person in the CompareTo method. This was accomplished by using the generic IComparable interface. Also, string concatenation in the CompareTo method was eliminated to avoid possible performance drag. Finally, the result of the LastName comparrison is cached in a variable name result to improve performance.&nb ... [ read more ]


A CTP version of Microsoft's Sandcastle was just released. What is Sandcastle's purpose? “To enable managed class library developers throughout the world to easily create accurate, informative documentation with a common look and feel.” Read more about it here -> http://blogs.msdn.com/sandcastle/ Download it here - > http://www.microsoft.com/downloads/details.aspx?FamilyId=E82EA71D-DA89-42EE-A715-696E3A4873B2&displaylang=en


Download here -->   101 SQL Server 2005 Samples Overview The samples download provides over 100 samples for SQL Server 2005, demonstrating the following components: Database Engine, including administration, data access, Full-Text Search, Common Language Runtime (CLR) integration, Server Management Objects (SMO), Service Broker, and XML Analysis Services Integration Services Notification Services Reporting Services Replication &nbs ... [ read more ]


Have any ideas for Paul? Paul Vick's Blog
Do you put on summer computer camp for kids?  Would you like to put on a computer summer camp but don't know where to start? If so, this blog is for you. For the seventh year in a row I put together a summer camp for the local high school students. It was by far the most successful camp yet due in no small part to the great programming products Microsoft now offers to the public at no charge. Here are the free Microsoft products and resources students downloaded, installed ... [ read more ]


Somaseger's blog on June 11th explains how Windows Presentation Foundation (WPF), Windows Communication Foundation (WCF), Windows Workflow Foundation (WF) and the newly christened Windows CardSpace (WCS) formerly known under the codename “InfoCard”  will become a part of the .NET Framwork.


Check it out -  EBay Selling Starter Kit


Have you been thinking about getting into generics with Visual Basic 2005 but have not found a simple place to start? Before you try to create your own generic classes, methods, structures, or interfaces, walk first - by using some of the generic types built into the .NET 2.0 class library. For example, try using the very useful and easy to use generic 'List' class. Here's an example of using a 'List' to store integers:      &n ... [ read more ]


Visual Basic and ASP.NET courses are available.


Fresh Off the Stove Want to get more productive? Visual Studio 2005 code snippets are available from these sites. Dot Net Junkies Got Code Snippets Project Distributor Got Dot Net And don't forget - hundreds of code snippets are included with Visual Studio 2005  ;-) What are Visual Studio 2005 Code Snippets? If you havn't discovered the code snippets feature in Visual Studio 2005 learn more about this productivity booster by viewi ... [ read more ]


When you install Visual Studio 2005 be sure to unzip the new graphics collection at: C:\Programs\Microsoft Visual Studio 8\Common7\VS2005ImageLibrary.zip Enjoy!  


ADO.NET adds the ToTable method to the DataView class.


And the free stuff keeps coming.... There are 17 FREE eLearning courses now available from Microsoft Learning dedicated to preparing you for Sql Server 2005 and Visual Studio 2005 These eLearning courses and corresponding course descriptions can be found at: https://www.microsoftelearning.com/visualstudio2005/ https://www.microsoftelearning.com/sqlserver2005/


To read the announcement click -> Paul Flessner: Notes from Microsoft® Tech•Ed 2005


They are giving away two books targeted for Visual Basic 6.0 programmers but open to everyone - Introducing Visual Basic 2005 for Developers and Upgrading Microsoft Visual Basic 6.0 to Microsoft Visual Basic .NET . You can download the first few chapters of each at VBRun: The Visual Basic 6.0 Resource Center . More chapters are to be posted each week.


Get 17 hours of hands-on ASP.NET training for Free - a $349 value! For a limited time only, Microsoft Learning is offering Developing Microsoft® ASP.NET Web Applications Using Visual Studio® .NET , a 17-hour self-paced online training course, for free ($349 value). Click here to get started and enter promotion code: 8317-MSDN-6595.
The blog comment spammers discouraged me from blogging for a couple of months. Now I'm back. I removed all the blog spam and turned off comments.  I can blog but you can't comment.  I know it's not fair but until I can prevent the blog comment spam it's how things are going to be.


I've decided to share, in a series of blog posts, what I have learned about upgrading from previous versions of Visual Basic to VB.NET. This week my company, aZ Software Developers, will begin our forty-sixth Visual Basic upgrade project. This project is for a new client. This client employs 4 Visual Basic 6 programmers. Thirty-two of our upgrade projects have been for clients who employ five or less full-time VB programmers. Having worked almost 100% of the time with .NET since 2001, ... [ read more ]


Distributed enterprise applications aggregate the power of mutiple servers and multiple software applications to collaboratively run a single computational task in a transparent and coherent way, so that they appear as a single, centralized system. It is the 'distributed' aspect of the distributed application architecture that introduces the need for an instrumentation framework that can measure and control the distributed application accross its logical and physical boundaries. I ... [ read more ]


First, the Connected Systems Business helps you see how Microsoft's hardware, software, patterns, and practices works to day and where its going in the future. Second, the Patterns and Practices Enterprise Library consolidates and updates seven of the application blocks Microsoft has produced.  The Connected Systems Kit The Connected Systems Kit is a collection of sample applications, presentations, white papers and videos that illustrate how to implement connected ... [ read more ]


Big Ball of Mud is an term that describes a system or computer program that has no real distinguishable architecture and is choking to death from all the mud that has been thrown on it to keep it alive. Brian Foote and Joseph Yoder popularized the Big Ball of Mud term in their Big Ball of Mud paper.  That paper defines the term as: "A Big Ball of Mud is a haphazardly structured, sprawling, sloppy, duct-tape-and-baling-wire, spagetti-code jungle. These systems show unmistakable sign ... [ read more ]


{ End Bracket }: C# and VBA: Like Oil and Water -- MSDN Magazine, February 2005 . 19 Jan. 2005 . “Some things just don't mix   as well as you would like. Take C# and Microsoft ® Excel 2003 or Word 2003, for example. Not only are these applications huge productivity tools, but they both also provide access to large object models that you can program against from your own applications. The problem is none of the documentation for the object models includes code samples ... [ read more ]


Steve Lasker at Microsoft just posted a great Beta 2 update on what the Data Design Team accomplished for Beta 2.  See it at: Data Design Time Changes Beta1 to Beta2  


Like the OLE Container control in Visual Basic 6 , the Visual Studio 2005 ActiveDocumentHost control lets you host active documents (OLE documents) in your Windows applications. For those who have tried to duplicate the behavior of the Visual Basic 6 OLE Container in Visual Studio 2002/2003, this is welcome relief.  In Visual Studio 2005 it's just a matter of dragging the ActiveDocumentHost control to a form, completing an 'Insert Object' dialog, and using the properties and methods o ... [ read more ]


The VB example code in the Visual Studio 2005 Beta1 help topic: “How to Implement Two-Way Communication Between DHTML Code and Client Application Code” does not work. By default, Visual Studio 2005 disables COM visibility. The class that will be the WebBrowser control's ObjectForScripting, Form1 in the example, must be COM visible. To give Form1 in the help topic example COM visibility use the ComVisible attribute to make it COM visible: _ Public Class Form1 ... [ read more ]


MSDN Webcast: Russ' Tool Shed Live Studio Audience Web Cast - Chapter 9 - Migrating VB6 to VB.NET—Level 200


With more Visual Basic Classic COM classes being utilized in VB.NET programs I am getting more questions like:  “What happens to my COM object after I use it?” and “Does the garbage collector destroy my COM object for me?”. In fact, it is up to you the COM user to ensure the COM object is destroyed when your program has finished using it. .NET provides the System.Runtime.InteropServices.Marshal.ReleaseComObject method for this purpose. Read abo ... [ read more ]


© 2005 Serge Baranovsky. All rights reserved.
All feed content is property of original publisher. Designated trademarks and brands are the property of their respective owners.

This site is maintained by SubMain(), a division of vbCity.com, LLC