Alessandro Del Sole's Blog

/* A programming space about Microsoft® .NET® */
posts - 159, comments - 0, trackbacks - 0

My Links

News

Your host

This is me! This space is about Microsoft® .NET® and Microsoft® Visual Basic development. Enjoy! :-)

These postings are provided 'AS IS' for entertainment purposes only with absolutely no warranty expressed or implied and confer no rights.

Microsoft MVP

My MVP Profile

I'm a VB!

Watch my interview in Seattle

My new book on VB 2015!

Pre-order VB 2015 Unleashed Pre-order my new book "Visual Basic 2015 Unleashed". Click for more info!

My new book on LightSwitch!

Visual Studio LightSwitch Unleashed My book "Visual Studio LightSwitch Unleashed" is available. Click the cover!

Your visits

Follow me on Twitter!

CodePlex download Download my open-source projects from CodePlex!

Article Categories

Archives

Post Categories

.NET Framework

Blogroll

Help Authoring

Microsoft & MSDN

Setup & Deployment

Visual Basic 2005/2008/2010

Visual Basic

Visual Basic 2015 Unleashed: my new book is available

It has been a long road, but my new book Visual Basic 2015 Unleashed is finally available. It is not a simple update from the previous edition, Visual Basic 2012 Unleashed. In the 2015 edition, I made significant revisions, fine-tuning contents as technology evolves from the Microsoft perspective. Also, I had the pleasure and the honor of featuring Anthony D. Green and Lucian Wischik from the Managed Languages team at Microsoft as the technical editors. They are the people who know Visual Basic better than any one on the Planet and their work has been invaluable to make this book even...

posted @ venerdì 7 agosto 2015 14:35 | Feedback (0) | Filed Under [ Visual Basic Visual Studio 2015 ]

New article series about Visual Basic 2015

I've started a new article series about Visual Basic 2015. More specifically, there are three new articles about the new code focused experience in VB and the .NET Compiler Platform. You might find the articles on the InformIT web site: Part 1 - The code focused experience in Visual Basic 2015 Part 2 - Live Code Analysis with Visual Basic 2015 Part 3 - Creating custom refactorings with VB 2015 (coming soon) Enjoy! Alessandro

posted @ martedì 14 luglio 2015 12:45 | Feedback (0) | Filed Under [ Visual Basic Visual Studio 2015 ]

My book Visual Basic 2015 Unleashed available for pre-order

I'll be writing a more detailed post with sample contents, however this is to inform you that my new book Visual Basic 2015 Unleashed can be pre-ordered on Amazon. There's a lot of new stuff that you might want to check out as a VB developer, such as Windows 10 development, .NET Compiler Platform (project "Roslyn"), and of course all the new language features. Check it out! Alessandro

posted @ martedì 14 luglio 2015 12:41 | Feedback (0) | Filed Under [ Visual Basic Visual Studio 2015 ]

OData v4 and Web API example with Visual Basic 2015

It's been a while since my latest blog post here. The reason is that I've been busy writing a new book about Visual Basic 2015, which is still under development, and with my Italian blog and resources. I'll try to write more frequently from now on. This post is to tell you that I've published a basic example about creating an OData v4 service with Web API and Visual Basic 2015. The excuse has been that there's no sample in Visual Basic. I have used Visual Studio 2015 CTP 6 and you can download the sample from MSDN Code Gallery Have fun Alessandro

posted @ venerdì 27 febbraio 2015 16:50 | Feedback (0) | Filed Under [ Visual Basic ]

A new app for Windows Phone 8 built with VB: Where are my Items?

It's been a long time since my last post in this blog. As you might know, I run an Italian community about Visual Basic so writing in two different languages concurrently can be hard, especially when you also author books about programming, such as Visual Basic 2012 Unleashed About Visual Basic, I use it everyday not only for building business apps and for authoring learning materials, I also use it for building apps for Windows Phone. I have recently published a new app, called Where are my Items? (download here). The goal of the app is saving the location of...

posted @ giovedì 3 ottobre 2013 12:51 | Feedback (0) | Filed Under [ Visual Basic Silverlight/Windows Phone Visual Studio 2012 ]

My new book "Visual Basic 2012 Unleashed" is available

I'm pleased and proud to announce that my new book "Visual Basic 2012 Unleashed" is available, both paperback and digital edition! This time I had the honor of featuring Lucian Wischik, the VB Specification Lead at Microsoft, as the author of a great foreword. As usual, it has really been a hard work, but fortunately working with a great team (including Matthew Kleinwaks as the tech editor) makes things easier. The book has been fully updated to target the .NET Framework 4.5 and the new features in the Visual Basic programming Language, such as the Async/Await pattern, new tools in the...

posted @ lunedì 28 gennaio 2013 22:43 | Feedback (0) | Filed Under [ Visual Basic Silverlight/Windows Phone Windows Presentation Foundation Windows Communication Foundation LINQ/EF/OData Misc .NET Framework Help Authoring Setup & Deployment Visual Studio Extensibility Visual Studio Express Editions Windows Azure Windows 8 & WinRT Visual Studio 2012 ]

My new video: Global namespace in Visual Basic 11

Visual Basic 11 Beta makes it easier to abstract the namespace definition outside the root namespace of the project by using the Global keyword for namespaces. I have recorded a new video to explain how it works, including extending namespaces of the .NET Framework's BCL: Alessandro

posted @ domenica 11 marzo 2012 19:12 | Feedback (0) | Filed Under [ Visual Basic ]

My new video: Call Hierarchy in Visual Basic 11

Visual Studio 11 Beta introduces the Call Hierarchy tool window for Visual Basic. This was already available in Visual C# in VS 2010, and allows getting a visual representation of calls from and to methods, showing the hierarchy of calls. Learn how to use it in this new video that I have just recorded: Alessandro

posted @ domenica 11 marzo 2012 19:09 | Feedback (0) | Filed Under [ Visual Basic ]

My new video: CallerMemberInfo in Visual Basic 11

The Beta of Visual Basic 11 introduces three new attributes: CallerFilePath, CallerLineNumber, and CallerMemberName. These allow retrieving information that previously could be available only via reflection, and including the .pdb debug files and in full-trust environments and you will typically use them in logging scenarios. Learn how to use them in this video: Alessandro

posted @ domenica 11 marzo 2012 18:58 | Feedback (0) | Filed Under [ Visual Basic ]

Windows Phone: listing and playing videos from YouTube (Visual Basic)

I am building an'app for Windows Phone 7.5 where I needed to show a list of videos from a YouTube channel, listing videos inside a ListBox and then allowing users to play the selected video. I never did this before, so I found an interesting article on Visual Studio Magazine that put me on the right direction and that I adapted to my needs (not least writing code in Visual Basic ). The first thing you need to do is constructing the Web address of the feed containing the desired list of videos. There is a number of URIs according to what you...

posted @ venerdì 20 gennaio 2012 23:04 | Feedback (0) | Filed Under [ Visual Basic Silverlight/Windows Phone ]

Windows Phone: protecting confidential data (Visual Basic)

Protecting user's confidential information is so important and it becomes even more when developing apps for mobile devices. When you create applications for Windows Phone you can still use existing skills related to the System.Security.Cryptography namespace of the .NET Framework, and one existing technique offers a simplified way to protect information via encryption. There is a class called ProtectedData which exposes two shared methods, Protect and Unprotect. The first method receives a string and returns its content under the form of an encrypted array of byte. The second method receives the encrypted array and returns the original, unprotected string. That said, let's see how to...

posted @ venerdì 20 gennaio 2012 22:39 | Feedback (0) | Filed Under [ Visual Basic Silverlight/Windows Phone ]

Windows Phone: saving pictures from the Web to the Pictures hub (Visual Basic)

The development platform for Windows Phone offers a number of APIs to interact with the Pictures Hub, which is the place where pictures are stored. A very frequently asked question is how to save pictures to the Hub, given their Web address. This first assumes you have permissions to do so . To accomplish this we first use the WebClient class to make an asynchronous download of the picture; next, we move the picture's content (which is an array of byte) into a file inside the isolated storage; finally, we move the picture to the Hub. The quickest way to interact with the...

posted @ venerdì 20 gennaio 2012 22:26 | Feedback (0) | Filed Under [ Visual Basic Silverlight/Windows Phone ]

Entity Framework: solving the "New transaction is not allowed because there are other threads running in the session" exception

It is not unusual to perform a For..Each loop over an entity set based on the ADO.NET Entity Framework. Something like this: For Each animal In MyModel.Animals 'Do something here... Next In the sample above the Animals entity set is of type ObjectSet(Of T), and of course T is a dummy Animal type. If you loop directly an ObjectSet(Of T) then the EF might return the following exception: "New transaction is not allowed because there are other threads running in the session". In order to solve this problem you must avoid performing the loop directly against the ObjectSet, which also means using something like the AsQueryable or ToList...

posted @ venerdì 20 gennaio 2012 22:19 | Feedback (0) | Filed Under [ Visual Basic ]

My new article on MSDN: Local Data Access in Windows Phone Mango

Today a new article of mine has been published on the Visual Basic Community contents page of the Visual Studio Developer Center (formerly known as Visual Basic Developer Center). The article's title is Local Data Access in Windows Phone Mango and it describes how to take advantage of SQL Server Compact Edition 3.5 in your apps to increase your productivity by storing data into a true database. Enjoy! Alessandro

posted @ lunedì 9 gennaio 2012 21:40 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Silverlight/Windows Phone ]

Invoking Bing Maps in Windows Phone Mango

One of the new interesting possibilities introduced by Mango in the Windows Phone development is invoking Bing Maps under the form of a Launcher object. Launchers are exposed by the Microsoft.Phone.Tasks namespace and allow activating device features, in this particular case the maps service by passing the desired search term. Invoking Bing Maps in code is very simple. The following snippet demonstrates how to start Bing Maps passing the desired address to the SearchTerm property of the BingMapsTask object. Such a task is then launched via a method called Show: Dim bingTask As New Microsoft.Phone.Tasks.BingMapsTask ...

posted @ lunedì 2 gennaio 2012 00:33 | Feedback (0) | Filed Under [ Visual Basic Silverlight/Windows Phone ]

Advanced LightSwitch: passing initialization information to custom data sources (with Visual Basic)

When you build WCF RIA Services for Silverlight you can pass initialization information to the service, so that you can initialize fields or properties or any other members required by the same service. When you have to create custom data source extensions for LightSwitch you still use WCF RIA Services but in a way that is a little bit difference according to some LightSwitch specific requirements. This also means that it is different the way you pass startup information to the service. Actually you can use the connection string, which is not limited to that piece of information that you would normally use to connect to...

posted @ mercoledì 21 dicembre 2011 18:40 | Feedback (0) | Filed Under [ Visual Basic Visual Studio LightSwitch ]

Converting text to HTML with Visual Basic

I have found this interesting article on CodeProject where they explain how to create a method that converts a String to HTML format by invoking the HttpUtility.HtmlEncode method, but the explanation is C# only. This approach is okay in Web projects, and I want to provide a Visual Basic translation: Public Shared Function HtmlEncode(text As String) As String Dim chars As Char() = HttpUtility.HtmlEncode(text).ToCharArray() Dim result As New System.Text.StringBuilder(text.Length + CInt(text.Length * 0.1)) ...

posted @ venerdì 9 dicembre 2011 11:01 | Feedback (0) | Filed Under [ Visual Basic ]

My new video: using Visual Studio LightSwitch with MySQL

One of the most frequently asked questions in the LightSwitch developer community is: how can I use LightSwitch with MySQL databases? So I decided to try myself (since I only work with SQL Server) and this video explains what tools you need to reach the goal and how you can connect to MySQL databases and work with data in LightSwitch. There's just a couple of code snippets (yeah, VB!) that you need to write. You can easily enable the full screen view or show the offline player:   > Enjoy! Alessandro

posted @ domenica 13 novembre 2011 00:14 | Feedback (0) | Filed Under [ Visual Basic Visual Studio LightSwitch ]

My new video: starting migrating an Access database to Visual Studio LightSwitch

Today I have recorded a new video in which I show how to use the SQL Server Migration Assistant for Access in order to start migrating a Microsoft Access database to SQL Server that you can later use in Microsoft Visual Studio LightSwitch 2011 as an external data source. Please note that the video explains a migration of tables and queries, but no VBA code is migrated to Visual Basic or C#. The reason is simply that it is not possible covering any possible code snippet but I think it is useful to have a starting point to begin migrating a...

posted @ venerdì 14 ottobre 2011 00:40 | Feedback (0) | Filed Under [ Visual Basic Silverlight/Windows Phone Visual Studio LightSwitch ]

My new video: Local data access in Windows Phone Mango with VB 2010

I have recorded a new video to show one of the most interesting new features in Windows Phone Mango, which is the support for local data access against SQL CE 3.5 databases. The video shows how to create the database on the device and how to access the data source, including adding, removing, and filtering data. Of course, in Visual Basic 2010! Remember to download the Windows Phone 7.1 SDK. I hope you find it useful. Double-click on the player to enable full-screen view. Alessandro

posted @ giovedì 13 ottobre 2011 00:10 | Feedback (0) | Filed Under [ Visual Basic Silverlight/Windows Phone ]

Advanced LightSwitch: calling built-in search from Silverlight controls (Visual Basic)

I'm migrating a big Silverlight 4 project to LightSwitch and I'm at a point in which I need to implement search screens and editable grids. My requirement was using the RadGridView control from Telerik, replacing the built-in DataGrid of LightSwitch. This implies creating a custom control. If you want to see an example, you can see my previous post about using the Telerik RadGridView in LightSwitch. The problem is that when you implement a custom control you also lose the built-in search box and data paging control, which are offered by search screens. So my goal was implementing search in a...

posted @ mercoledì 21 settembre 2011 00:54 | Feedback (0) | Filed Under [ Visual Basic Visual Studio LightSwitch ]

Scaling code in Windows Phone 7 with the Thread Pool

Whichever technology you use to develop your applications, one sentence is always in your mind: don't block the UI thread. Of course this state of mind is important when you also build apps for Windows Phone 7. It is not unusual for a Windows Phone app to download information from the Internet and display long lists of data. Although the cpu in this kind of devices is quite fast, there are some factors that can bring negative performances, such as slowness of the internet connection, rendering long list of items with complex data templates and so on. So you need a...

posted @ giovedì 23 giugno 2011 15:54 | Feedback (0) | Filed Under [ Visual Basic ]

Using statement lambdas in Visual Basic with Windows Phone 7

I have written several apps for Windows Phone 7 with Visual Basic 2010, and I made an intensive usage of statement lambdas. Some of my apps require downloading RSS feeds from the Internet and this is accomplished by instantiating the WebClient class. For instance, consider the following code that retrieves some string content from the Internet and loads the content into an XDocument:          Dim wclient As New WebClient()            'The statement lambda is a replacement for AddressOf         AddHandler wclient.OpenReadCompleted, Sub(sender As Object, e As OpenReadCompletedEventArgs)                                                   If e.Error IsNot Nothing Then                                                       MessageBox.Show(e.Error.Message)                                                       RaiseEvent ErrorThrown()                                                       Exit Sub                                                   End If                                                   Dim str As IO.Stream = e.Result                                                   Dim xdoc As XDocument = XDocument.Load(str)                                                   ' Process your xdoc here...                                                   ' close                                                   str.Close()                                                   ' add results to listbox                                                   panoramaElement.DataContext = rssFeedsItems                                               End Sub         wclient.OpenReadAsync(rssUri) Instead of writing a dedicated event handler, I wrote a statement lambda directly in the AddHandler clause in place of the AddressOf pointing to a delegate. Also notice how the lambda receives arguments of the...

posted @ giovedì 23 giugno 2011 15:31 | Feedback (0) | Filed Under [ Visual Basic ]

How-to: get the "Powered by Windows Azure" logo for your LightSwitch applications

Some time ago Microsoft launched the new Microsoft Platform Ready portal, where you can certify your applications based on a number of recent technologies from Microsoft, including Windows Azure. As you know, LightSwitch applications can be easily deployed to Windows Azure and in this scenario they use SQL Azure databases. The MPR program enables certifying applications relying on both technologies, so you can certify your LightSwitch applications running on the Cloud. So let's try and see how to accomplish this. First, you just need to create a LightSwitch application with at least one table and one screen, no matter how complex...

posted @ venerdì 27 maggio 2011 21:14 | Feedback (0) | Filed Under [ Visual Basic Visual Studio LightSwitch ]

Visual Studio LightSwitch: acquiring images from devices with Visual Basic and the WIA APIs

Visual Studio LightSwitch is an extensible environment and is based upon Silverlight 4. The combination of these two factors allows creating a lot of additional stuff so that you can provide features that are not available by default. Today the goal is understanding how to use COM Automation in Silverlight 4 to acquire images (and possibly documents) from scanners in a LightSwitch application. Before going on, it is worth mentioning that COM Automation requires elevated privileges so this means that the application must run as a desktop client (out-of-browser). So let's create a new LightSwitch project. I will show some Visual Basic code but translating...

posted @ domenica 22 maggio 2011 18:29 | Feedback (0) | Filed Under [ Visual Basic Visual Studio LightSwitch ]

Using Telerik controls in LightSwitch for exporting, filtering, and sorting data - part 2

In the previous post we saw how to create a Silverlight user control that embeds some controls from the RadControl for Silverlight by Telerik, to be used in LightSwitch applications. Basically we created the control, replaced the built-in DataGrid in LightSwitch, performed the data-binding and we have seen how this perfectly works. We also prepared some buttons for printing and exporting features, which will be implemented in this post. But we'll do more: we'll demonstrate that the previously created custom control is also reusable. Let's start from this point, and add a new screen of type EditableGrid pointing to the Orders collection: Once the Screen Designer...

posted @ giovedì 19 maggio 2011 13:19 | Feedback (0) | Filed Under [ Visual Basic Visual Studio LightSwitch ]

Using Telerik controls in LightSwitch for exporting, filtering, and sorting data - part 1

One of the hottest topics for those folks that are evaluating the Betas of Visual Studio LightSwitch is the possibility of using 3rd party user controls, but also printing and reporting. Of course you have the possibility of doing that, by using user controls written upon Silverligh 4.0. I intensively use the RadControls for Silverlight di Telerik suite, which is very good and that enriches the Visual Studio 2010's toolbox. It seems that Telerik is planning to create extensions for LightSwitch, but you can actually use controls from the current suite. In this (and the next) blog post we'll see how...

posted @ giovedì 19 maggio 2011 13:02 | Feedback (0) | Filed Under [ Visual Basic Visual Studio LightSwitch ]

Where's ByVal?

If you installed Service Pack 1 for Visual Studio 2010 and you are a VB, you might have noticed that when writing methods the ByVal keyword is no longer added for method arguments. For instance, this code is legal:     'Missing explicit ByVal     Private Sub aMethod(anArgument As Integer)     End Sub The reason is that a method argument is ByVal by default, unless you specify ByRef. So the keyword can be omitted, but you can also add it explicitly if you prefer. Alessandro

posted @ domenica 8 maggio 2011 23:38 | Feedback (56) | Filed Under [ Visual Basic ]

Windows Azure: interacting in Visual Basic code with the Blob Storage - part one

With this blog post I would like to start a series about how we can interact from Visual Basic 2010 with the on-line Cloud Storage offered by Windows Azure. My goal is not discussing what Windows Azure is and how the storage works (except for some necessary hints), since you can find more detailed documentation across the Internet; instead I will show you how to write code for managing containers and blobs in your storage account. My assumptions about you I assume that you already have an account on Windows Azure and that you already created your storage account. If you need...

posted @ sabato 26 marzo 2011 20:39 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Windows Azure ]

Announcing Azure Blob Studio 2011 on CodePlex: a new blob storage manager written in Visual Basic 2010

I just released onto CodePlex a new tool called Azure Blob Studio 2011. This tool provides an easy way to manage files on your Windows Azure's blob storage, including both the online and developer accounts; it is available in two editions: stand-alone WPF client extension for Visual Studio 2010 (precisely a tool window) The stand-alone client is available via a ClickOnce installer, whereas the extension is available as a VSIX package from the Visual Studio Gallery (and the Extension Manager tool in VS). With this approach you can receive updates easily. The application has...

posted @ martedì 28 dicembre 2010 12:42 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Windows Presentation Foundation Windows Azure ]

Announcing Vsi Builder 2010, a new extension for Visual Studio 2010

I just released on CodePlex and on the Visual Studio Gallery a new extension for Visual Studio 2010 named Vsi Builder 2010, due to a good feedback coming from a previous, stand-alone version for VS 2008. What is it about? The new extensibility model in Visual Studio 2010 introduced the new VSIX file format and the concept of "extension" in order to share and install components for Visual Studio 2010, such as tool windows, packages and code editor extensions. The problem is that reusable code-snippets (.snippet files) and old-style add-ins cannot be packaged and deployed via the VSIX format. In fact, they...

posted @ lunedì 6 dicembre 2010 18:48 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Visual Studio Extensibility ]

Creating an RSS feed reader for Windows Phone 7 with Visual Basic 2010

Today Microsoft released the RTW of the developer tools for Windows Phone 7 in Visual Basic 2010 (download links here)! To celebrate this important milestone, I've published a new contribution named "Creating an RSS feed reader for Windows Phone 7 with Visual Basic 2010" under the form of an article, a short video and a source code example: Read the article Watch the video: Download the code Enjoy! Alessandro

posted @ lunedì 29 novembre 2010 19:26 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Silverlight/Windows Phone ]

Visual Studio LightSwitch: binding a Silverlight Pie Chart control to screens

As you know, it is easy to extend the user interface of screens in LightSwitch applications by adding custom Silverlight controls. The Silverlight Toolkit adds to your toolbox a number of new useful controls, especially for data visualization such as charts. In this post I will show you how to add a Pie Chart to a screen listing products.Imagine you have an entity named Product, like the following which I grabbed from the Northwind database: Once you have this entity, imagine you also have a Search Screen pointing to the Products collection. Since the list of products is quite long, we...

posted @ venerdì 26 novembre 2010 18:25 | Feedback (0) | Filed Under [ Visual Basic Silverlight/Windows Phone Visual Studio LightSwitch ]

Visual Studio LightSwitch: connecting to SQL Azure databases

Among the available data sources that Visual Studio LightSwitch allows connecting to, since the current beta, we can find SQL Azure databases. SQL Azure is the database "on the cloud" of the Windows Azure Services Platform. The cool thing is that once you have your database on SQL Azure, the way you connect to it does not change. Once LightSwitch is running, click "Attach to an external database". Next select Database as the data source:   Next you have to specify connection parameters such as the SQL Azure server name, user name and password (you work with SQL authentication) and, of course, the database name: In my case...

posted @ domenica 21 novembre 2010 11:37 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Windows Azure Visual Studio LightSwitch ]

Visual Studio LightSwitch: implementing and using extension methods with Visual Basic

As you know Visual Studio LightSwitch allows building business applications quickly and easily with an approach of type Data + Screens = Business Applications. This approach simplifies a lot the application development, even for developers who are new to programming, but necessarily requires some restrictions on customizing some application parts. In reality, LightSwitch applications are 100% .NET applications running on the Silverlight 4 platform, meaning that you can reuse a lot of your existing skills about .NET and managed languages, such as extension methods. For example, imagine you have a simple entity named Contact which exposes a property called WebSite of type String, which stores the contact's web site...

posted @ giovedì 4 novembre 2010 12:08 | Feedback (0) | Filed Under [ Visual Basic Visual Studio LightSwitch ]

WPF: text wrapping inside DataGrid cells

When working with the DataGrid in WPF, you generally use the DataGridTextColumn object for displaying or editing text. Such an object has a limitation: there is no property for specifying that the text should be automatically wrapped according to the column width, similarly to what you can do in Microsoft Excel. Fortunately the solution is pretty easy. In fact you can use the DataGridTemplateColumn element (a generic object which allows deep customizations for cell templates) and inside it you implement one TextBox for text editing and one TextBlock for displaying text; such controls expose the TextWrapping property that we can use for wrapping the text. Here's the...

posted @ giovedì 14 ottobre 2010 18:08 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Windows Presentation Foundation ]

Interacting with Windows Server Update Services from Visual Basic code

A few days ago I had to solve an unusual problem, since I never had to face it before and because it was basically "out of scope" if related to my usual job. Inside the organization that I work for, where several thousands of users work, Windows updates are deployed via the Windows Server Update Services which are installed on server machines. One of the domain administrators had the need of increasing the maximum number of allowed connections to WSUS from 30000 to 50000 but he wasn't able to find a solution until he found this page in the MSDN library,...

posted @ lunedì 20 settembre 2010 19:00 | Feedback (0) | Filed Under [ Visual Basic ]

Rapid application development with Visual Studio LightSwitch

Probably many of you already know that recently Microsoft announced the first beta of a new product in the Visual Studio family, called Visual Studio LightSwitch that is publicly available since August 23rd. In this blog post I'm going to make an overview of LightSwitch with a few words and some pictures. What Visual Studio LightSwitch Is (and my personal thought for VB 6 developers) Visual Studio LightSwitch is an integrated development environment for rapidly developing Line Of Business Applications. Rapid because the pipeline is: "I create my data -> I define my screens -> LightSwitch prepares the infrastructure -> I just press F5...

posted @ mercoledì 25 agosto 2010 16:20 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Silverlight/Windows Phone Visual Studio LightSwitch ]

WPF: Introducing the Model-View-ViewModel pattern for Visual Basic 2010 developers - full series summary

Following the last part of the blog post introductory series on MVVM in WPF 4 applications with Visual Basic 2010, I think that you can find useful the full list of 10 posts for easier reading. Here they are: "WPF: Introducing the Model-View-ViewModel pattern for Visual Basic 2010 developers" Part 1 (introduction) Part 2 (command logic) Part 3 (details view + generic RelayCommand) Part 4 (data validation) (From part 5 on, MVVM is against the ADO.NET Entity Framework) Part 5 (Entity Data Model creation + data validation) Part 6 (Message Broker and commanding) Part 7 (service layer) Part 8 (creating ViewModels) Part 9 (refactoring + unit testing) Part 10 (Views definition, UI and code download) I'm planning some further blog posts...

posted @ venerdì 13 agosto 2010 17:01 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Windows Presentation Foundation ]

WPF: Introducing the Model-View-ViewModel pattern for Visual Basic 2010 developers - part 10 (and last!)

This is definitely the last blog post of the introductory series about the Model-View-ViewModel in WPF with Visual Basic 2010, particularly against the ADO.NET Entity Framework. I will explain how to build the user interface and how to bind it to ViewModels. Although this is the last blog post of the series, this does not mean that I will no longer discuss MVVM with VB 2010. On the contrary this will be an important topic for this blog, but for the sake of clarity I will distinguish topics in different blog posts and today we will complete the sample application. You can find...

posted @ venerdì 13 agosto 2010 16:52 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Windows Presentation Foundation ]

WPF: Introducing the Model-View-ViewModel pattern for Visual Basic 2010 developers - part 9

So far we wrote a lot of code, in this blog post series related to MVVM in WPF with Visual Basic 2010. Of course there are a lot of things to improve before heading to the last part. This will also allow us discovering a great benefit from using MVVM, which is writing unit tests against the ViewModel. Let's start by refactoring some code. Refactoring time! Refactoring the code is something that is mainly about both ViewModels. OrdersViewModel is the one requiring more attention. The first thing we want to improve is how the code uses the RelayCommand class: since we also wrote a...

posted @ giovedì 12 agosto 2010 15:46 | Feedback (46) | Filed Under [ Visual Studio 2010 Visual Basic Windows Presentation Foundation ]

WPF: Introducing the Model-View-ViewModel pattern for Visual Basic 2010 developers - part 8

Let's go ahead with our discussion about the MVVM pattern in WPF applications with VB 2010. Last time I explained how to implement a service layer; in this post I will focus on ViewModels. Particularly I will show where to place an instance of the Messenger class and then I will show all the required ViewModels. Because of this it will be a quite long work, especially in terms of lines of code since concepts have all been explained in this previous post. Send me a message! In all tutorials I found (and studied) declaring an instance of the Messenger class...

posted @ giovedì 12 agosto 2010 14:51 | Feedback (34) | Filed Under [ Visual Studio 2010 Visual Basic Windows Presentation Foundation ]

Free chapters from my book "VB 2010 Unleashed"

I would like to let you know that you can download for free the "web-only" chapters from my book "Visual Basic 2010 Unleashed". These are chapters that we could not include in the printed book for space reasons. They are available in PDF format from the following links: Chapter 56: Advanced IDE Features. Chapter 57: Introducing the Visual Studio Extensibility. Chapter 58: Advanced Analysis Tools. Chapter 59: Testing Code with Unit Tests, Test-Driven Development, and Code Contracts. In these chapters I discuss the Visual Studio extensibility, advanced IDE features (such as code snippets and templates), analyisis tools like IntelliTrace and...

posted @ giovedì 5 agosto 2010 13:11 | Feedback (0) | Filed Under [ Visual Basic ]

WPF: Introducing the Model-View-ViewModel pattern for Visual Basic 2010 developers - part 7

Let's retake our journey through the MVVM pattern in WPF 4, with Visual Basic 2010, against ADO.NET Entity Framework. Last time we saw how to implement a Messenger class, describing what it is for although we'll see such a class in action in my next post. In this article we will write some code for data access which is important to understand how complex can be building applications based on the MVVM but also how many benefits it can bring into your developer life. Problem of the day: does the ViewModel know what's the data source? I confessed that I had to delay the...

posted @ lunedì 2 agosto 2010 23:42 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Windows Presentation Foundation ]

WPF: Introducing the Model-View-ViewModel pattern for Visual Basic 2010 developers - part 6

ln my previous post I began describing how to use the MVVM pattern against a model based on the ADO.NET Entity Framework inside WPF apps built with Visual Basic 2010. Quick recap Last time we:  created the Entity Data Model discussed how this can constitute our Model, representing the data implemented data validation rules on the Model side taking advantage of IDataErrorInfo In this new post you will see some more code strictly related to the MVVM pattern, although the most complex work has to come yet. By the way, you will also find a solution to an important problem that I will describe in the last part of the...

posted @ martedì 27 luglio 2010 10:36 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Windows Presentation Foundation ]

WPF: Introducing the Model-View-ViewModel pattern for Visual Basic 2010 developers - part 5

After a quite long interval since my last post on the Model-View-ViewModel pattern with WPF 4 and Visual Basic 2010, let's retake the discussion starting from my promise about discussing such a pattern in a more interesting scenario: the ADO.NET Entity Framework. Before I show you some code, I need to do some explanations. Where do we want to go? At the end of the blog post series we will have the following application up and running: It is a very simple master-details application, that will also allow launching a new dialog window. With no doubt really and really simple. But it's simple if...

posted @ domenica 25 luglio 2010 18:42 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Windows Presentation Foundation ]

WPF: Introducing the Model-View-ViewModel pattern for Visual Basic 2010 developers - part 4

In my previous post related to the introductory series about the Model-View-ViewModel pattern with Visual Basic 2010, I discussed how to implement the capability of browsing data exposing an ICollectionView from the ViewModel; also, we saw how to provide a generic implementation of the RelayCommand class.   The purpose of this post is extending the previous application adding data validation features, taking advantage of WPF's ErrorTemplate and the IDataErrorInfo interface. It's worth mentioning that this is just one possible solution to the data validation problem, but you are free to provide your own. The approach that I'm...

posted @ lunedì 28 giugno 2010 19:17 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Windows Presentation Foundation ]

WPF: Introducing the Model-View-ViewModel pattern for Visual Basic 2010 developers - part 3

In the first two articles of this series about the Model-View-ViewModel pattern with VB 2010 we saw hot to build applications that load, show and save data through a ViewModel exposing data and commands to the View. In this blog post we'll make a further step, implementing a navigation technique between data that will allow us to browse the data themselves. Since images can speak better than words, this is the objective that we'll reach today:     As you can see the user interface is different from the previous sample application. Now we have a details view for each item plus some buttons for...

posted @ domenica 27 giugno 2010 13:19 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Windows Presentation Foundation ]

WPF: Introducing the Model-View-ViewModel pattern for Visual Basic 2010 developers - part 2

In my previous post I introduced the main features of the Model-View-ViewModel pattern in Windows Presentation Foundation, saying that this is an introductory blog post series dedicated to Visual Basic developers. I showed how to create a simple data model, a basic ViewModel for loading data and sending them to the View which was simply responsible of presenting loaded data.   In this blog post we want to make a further step, which is also quite complex: adding commands that will be bound to some buttons. If you had a chance of working with the so-called "commanding pattern", probably a lot of concepts...

posted @ venerdì 25 giugno 2010 13:10 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Windows Presentation Foundation ]

WPF: Introducing the Model-View-ViewModel pattern for Visual Basic 2010 developers - part 1

This is the first post of a new introductory series about the famous Model-View-ViewModel pattern, from the perspective of a Visual Basic 2010 developer. The reasons of this series are mainly the following: yes, there are tons of articles, posts, discussions about M-V-VM but most of them are for advanced users most of the available materials refer to Visual C# and there is not much VB code Before going on, I suggest you to read the very famous article by Josh Smith on MSDN Magazine, which is probably the most complete article on this topic. Next, M-V-VM can be applied to both...

posted @ mercoledì 16 giugno 2010 12:14 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Windows Presentation Foundation ]

My book "Visual Basic 2010 Unleashed" is available

I'm pleased to announce that my book "Visual Basic 2010 Unleashed" is finally live! It's my first English book and it offers more than 1200 pages where the syntax of Visual Basic 2010 is analyzed in details but it is also a book that describes how Visual Basic today can be used against the most recent Microsoft technologies for both Windows and the Web. (Click for larger image) It has been a really hard work but I feel proud of it :-) With regard to contents, actually this book is not intended for absolute beginners; instead it is intended for an audience...

posted @ mercoledì 12 maggio 2010 10:49 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Visual Studio Tools for Office Silverlight/Windows Phone Windows Presentation Foundation Windows Communication Foundation LINQ/EF/OData .NET Framework Setup & Deployment Visual Studio Extensibility Visual Studio Express Editions ]

"XAML Code Snippets" addin for VS 2010 updated to target RTM

Some time ago I published onto CodePlex a new addin for Visual Studio 2010, named "XAML Code Snippets", which provides custom support for adding and exporting XAML code snippets in the WPF and Silverlight XAML code editor. Now I updated the source code in order to target VS 2010 RTM (also fixing some minor bugs). You can find it here. Also the addin has now a page on the Visual Studio Gallery, available here, meaning that can be found via the Extension Manager dialog in Visual Studio. Your feedback would be really appreciated. Alessandro

posted @ lunedì 26 aprile 2010 00:34 | Feedback (103) | Filed Under [ Visual Studio 2010 Visual Basic Silverlight/Windows Phone Windows Presentation Foundation ]

WPF: Initializing My.User

If you use the My namespace from Visual Basic in WPF applications, especially the User object which allows accessing properties about the logged user, you might encounter a small problem. While in Windows Forms the following line returns the user name in the form of Domain\UserName: Dim userName As String = My.User.Name in WPF the same line of code returns an empty string. So, how can we solve this? there are basically two solutions. The first one is initializing My.User as follows: My.User.InitializeWithWindowsUser() 'then invoke My.User.Name Dim userName As String = My.User.Name The second solution is utilizing the WindowsIdentity class as follows: Dim userName As String = System.Security.Principal.WindowsIdentity.GetCurrent().Name If you like...

posted @ giovedì 22 aprile 2010 12:47 | Feedback (0) | Filed Under [ Visual Basic Windows Presentation Foundation ]

XAML Code Snippets, a new addin for VS 2010

I just published onto CodePlex a new WPF project, an addin for Visual Studio 2010 which allows adding and exporting XAML code snippets and that is supported by both WPF and Silverlight editors. You simply need to right click inside the XAML code editor and select the command you need (insert or export). The addin uses the classic .Snippet file format and the code is saved (or read) as XML. I took this approach to maintain compatibility with the VS .Snippet format. Screenshots, getting started instructions and the source code, in Visual Basic 2010, are available in the project workspace here. Since the XAML editor does not natively support code snippets, differently from...

posted @ giovedì 25 marzo 2010 00:47 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Windows Presentation Foundation Visual Studio Extensibility ]

Creating, packaging and deploying extensions for Visual Studio 2010

Microsoft Visual Studio is an extensible environment, in that it is possible creating and installing additional components offering new functionalities that the IDE does not include. As you may know, Visual Studio 2010 is a revolutionary environment because most of its architecture is based upon WPF and this also changes the extensibility. Except for Addins and Code Snippets, that you still package via the old .vsi file format, VS 2010 introduces the new .vsix format that enables packaging and installing the so called extensions, thus additional components such as templates, tool windows, editor extensions and user controls to be installed to the Toolbox. Visual...

posted @ domenica 14 marzo 2010 23:17 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Visual Studio Extensibility ]

Querying the Windows' events with LINQ and Visual Basic

Some time ago, in the Italian MSDN forum about Visual Basic, a user asked how it is possible querying the Windows' log events registry based on the given ID. This is really easy with LINQ. First, you get a reference to the Windows' events registry via an instance of the System.Diagnostics.EventLog class. The constructor requires as an argument the log name you want to query (e.g. Application, Security, Setup etc.). Once you get the instance, you can write a LINQ query for filtering only entries marked with the given ID. Each entry is represented by EventLogEntry objects. The following code demonstrates how to...

posted @ lunedì 8 marzo 2010 00:05 | Feedback (0) | Filed Under [ Visual Basic LINQ/EF/OData ]

Why you should use Visual Studio 2010 for Visual Basic 2005/2008 projects

In most cases, applications have quite long life. In other situations, today you might still need to create applications built upon .NET Framework 2.0 or 3.0 although we have .NET 3.5 SP 1. Similarly, when .NET 4.0 RTM will be available, in some circumstances you will still need building applications upon .NET 3.5 SP 1. As it was for in Visual Studio 2008, Visual Studio 2010 (available in Release Candidate) also supports multi-targeting so it is able of creating applications targeting specific versions of the .NET Framework, starting from the 2.0. The good news is that when you open old solutions or projects in Visual Studio 2010,...

posted @ domenica 7 marzo 2010 23:55 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic ]

Ten top reasons for installing Windows 7 Software Development Kit

Since many years, Microsoft releases for free the Windows SDK, an important toolkit targeting specific versions of the operating system, for developers. With no doubt it's a must-have resource, but in some cases it's not well known. I'd like to point out some top reasons (in my opinion, of course) for downloading and installing Windows 7 SDK, if you are developers planning to build applications for Windows 7: it contains debugging tools for native code (the famous WinDbg) it's available for both 32 and 64 bit operating systems it's available for the .NET Framework 3.5 Service Pack 1 even if you do not have Visual Studio, thus with...

posted @ martedì 23 febbraio 2010 23:51 | Feedback (0) | Filed Under [ Visual Studio 2008 Visual Studio 2010 Visual Basic Windows 7/Vista ]

Windows 7 & WPF 4: using task bar icons like progress bars

Did you ever try to download a file from the Internet with Windows 7? If yes, maybe you noticed that the Internet Explorer icon in the task bar shows the download progress, like a classic ProgressBar. With WPF 4 and VB (o C#) 2010 it's possible programming this interesting functionality in order to make our applications able of showing the progress state of a given task. The code example shown in this blog post simply wastes some time in an asynchronous way so that it can send progress state to a ProgressBar control and to the icon in the task bar (the reason...

posted @ venerdì 29 gennaio 2010 17:42 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Windows Presentation Foundation ]

Windows 7 & WPF 4: overlaying task bar icons

In this blog post I will discuss another interesting feature from Windows 7, that you can program via WPF 4 and VB/C# 2010, which is overlaying icons. You might have noticed how the Windows 7's task bar is not just a place where application icons are grouped, but it it also the ideal place for notifying the user about the application state or about the state of a task executed by the application. Basically you can overlay a custom icon with transparency over the application icon in order to notify the user about a particular situation, without the need of...

posted @ giovedì 28 gennaio 2010 12:39 | Feedback (179) | Filed Under [ Visual Basic Windows Presentation Foundation Windows 7/Vista ]

Windows 7 & WPF 4: interacting in code with the Jump List

Windows 7 introduces a new feature known as Jump List. Basically when you right-click an icon on the task bar you get access to a context menu showing a list of common tasks or simply a list of recent files, divided into groups and categories. With WPF 4 and Visual Basic (or C#) 2010 you can interact with the Jump List by writing some lines of code so that you can associate items lists from your application making such lists available to the user. WPF 4 exposes the System.Windows.Shell namespace offering some classes that allow accessing the Jump List, particularly the JumpList class representing the above described...

posted @ domenica 24 gennaio 2010 15:10 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Windows Presentation Foundation ]

Windows 7 & WPF 4: adding buttons onto task bar icons

Windows Presentation Foundation 4, the new version currently available in Beta 2 which will be part of .NET Framework 4/VS 2010, offers native integration with Windows 7 without the need of utilizing external components and libraries (at least for most activities). Among available functionalities, multi-touch and task bar integration are the most important. In this post I'm going to discuss how you can add buttons to the application's icon in the Windows task bar, very similarly to what you can see by running Windows Media Player, which provides button for controlling the media being played, available when the mouse pointer passes over the application icon: The goal of...

posted @ domenica 24 gennaio 2010 12:17 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Windows Presentation Foundation ]

Block selection in Visual Studio 2010 Beta 2

The Visual Studio 2010 Beta 2 code editor introduces a new interesting feature, known as Block Selection, which allows selecting and editing code portions. If you are a Microsoft Word user, you get something similar when you press Ctrl+Shift+F8. In Visual Studio 2010 you press Alt and select the desired code block with the mouse, as represented in the following figure where the idea is replacing Protected with Public on both lines: If we now begin writing, what we'll write will be automatically placed onto both lines of code in one shot: This of course works if lines of code are many more and with empty lines too :-) For...

posted @ sabato 28 novembre 2009 17:32 | Feedback (4) | Filed Under [ Visual Studio 2010 Visual Basic ]

Anchoring Dev10's code windows to Windows 7

If you are Windows 7 users, probably you know that you can anchor windows to the four sides of the screen by simply clicking the windows' title bar and moving to the desired side. This will automatically resize your window; for example, if you drag a window to the right side of the screen, such window will be automatically anchored and resized so that it will occupy half of the screen. Then, with Visual Studio 2010 Beta 2 it is possible dragging code window outside the IDE and treating them like any other window. Try: open a project, click the tab related to the desired code file,...

posted @ mercoledì 25 novembre 2009 23:58 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic ]

Manually installing off-line documentation for Visual Studio 2010 Beta 2

It could happen that when completing Visual Studio 2010 Beta 2 setup, the button for launching the off-line documentation installation is not available or that the specific link in the installer start page is disabled. If you experience this problem, don't worry; it is of course possible installing the off-line documentation later. Select the Manage Help Settings command in the Help menu within Visual Studio: The Help Library Manager will run; from here you will be able to install the documentation, for example selecting Find Content On Disk:   This last option requires the availability of the installation media for Visual Studio. Alessandro

posted @ mercoledì 25 novembre 2009 23:46 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic ]

Updated code for my "Export selection as Code Snippet" add-in for VB 2010 Beta 2

Some time ago I published onto CodePlex an open source add-in for Visual Studio 2008 which allows exporting the selected code block within the code editor to a reusable code snippet (.snippet file), providing full VB 2008 source code, installer and video. I decided to update the add-in to target Visual Studio 2010 Beta 2, with Visual Basic 2010. I had no particular problems in updating my code and I could also take advantage of some new features such as auto-implemented properties which make the code clearer. I still used Xml literals and Linq to Xml for easily generating snippets. If anyone of you...

posted @ venerdì 30 ottobre 2009 00:14 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Visual Studio Extensibility ]

XAML serialization with .NET 4.0 and VB 2010

To be honest the technique I'm going to describe in this blog post is not really new in .NET 4.0 (although I'm going to explain it with Visual Basic 2010), by the way the new Framework version introduces something new. First, there is a new assembly named System.Xaml.dll which is responsible for processing and parsing XAML code in WPF applications. Most of what was part of the WindowsBase.dll assembly about XAML, now is exposed by the new library which exposes a namespace named System.Xaml.   Now it's time to discuss the technique that entitles this blog post. During...

posted @ sabato 17 ottobre 2009 23:45 | Feedback (0) | Filed Under [ Visual Basic Windows Presentation Foundation ]

WPF 4: assigning images to Image controls at design-time

Another improvement to the Visual Studio 2010 designer for WPF that you can check out in the Beta 1 is the capability of assigning images to Image controls at design-time in a better way. After adding Image controls to the UI, simply click the "..." button for the Source property in the Properties window. This will show up the Choose image dialog (see figure below) where you can select one or more images: The interesting thing is the Path text box: Visual Studio shows the so called Packed Uri pointing to the image. At this point selected images are basically part of the...

posted @ giovedì 8 ottobre 2009 14:35 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Windows Presentation Foundation ]

WPF 4: setting controls' color brushes in the Visual Studio 2010 designer

If you are interested into WPF and you had a chance of trying the bits of Visual Studio 2010 Beta 1 you will have probably noticed some improvements to the WPF designer (also known as Cider) although this is just the first Beta. In fact the designer now offers more advanced tools than in the past. One of such tools provides the ability of setting controls colors, such as Background, Foreground and all those properties that you can assign with brushes. For example, if you want to define a gradient color as the background to a Window you simply click the Background property within the Properties window to...

posted @ mercoledì 7 ottobre 2009 23:52 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Windows Presentation Foundation ]

Updated version of my WPF client for Azure's blob storage

Some time ago I published onto CodePlex the first version of a WPF client to manage files on the Windows Azure blob storage. I just updated the application so that it can take advantage of the July 2009 CTP of Windows Azure SDK APIs removing also some unused references to unit testing assemblies that caused crashes with ClickOnce installations. If you are interested in Windows Azure and you need a simple tool for uploading and removing files and folders in the blob storage without reinventing the wheel, try to take a look at its CodePlex workspace :-) The client's source code is in Visual Basic 2008, while...

posted @ sabato 26 settembre 2009 17:36 | Feedback (0) | Filed Under [ Visual Basic Windows Presentation Foundation Windows Azure ]

Listing files from a directory with LINQ and .NET 4.0

Every time a new version of the .NET Framework is available we probably think of new great technologies (or at least this is for me) but often there are also some small improvements to the Base Class Library. I just discovered that the System.IO.Directory class implementation in .NET Framework 4.0 Beta 1 now exposes a method named EnumerateFiles, which works like the well known GetFiles, but differs in that it returns an IEnumerable(Of String) making the result directly queryable with LINQ. This is an example:         Dim filesEnumerable As IEnumerable(Of String) = Directory.EnumerateFiles("C:\", "*.exe") You use it exactly as...

posted @ domenica 20 settembre 2009 14:34 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic LINQ/EF/OData ]

Behind the scenes of the ObservableCollection(Of T)

When developing WPF applications, in many situations you will use the ObservableCollection(Of T) that supports the two ways data-binding and therefore it is able to notify the UI of changes happening on items of the collection itself. This is due to the implementation of the INotifyPropertyChanged interface.   It is interesting to understand how this works behind the scenes. For the sake of simplicity, for this blog post I created a Console application adding a reference to the WindowsBase.dll assembly that defines the above mentioned collection.   The ObservableCollection basically works like the List(Of T), meaning that it exposes methods such as Add, Remove and so on. Now let's imagine we want...

posted @ martedì 1 settembre 2009 19:39 | Feedback (0) | Filed Under [ Visual Basic Windows Presentation Foundation ]

The BigInteger type with Visual Basic 2010

Among the new types provided by .NET Framework 4.0, available also in the current Beta 1, there is the new System.Numerics.BigInteger. Such object's purpose is representing a signed integer, arbitrarily large, meaning that it has neither minimum nor maximum values, as instead happens about other .NET value types. In fact BigInteger doesn't expose the MinValue and MaxValue properties. The one thing you need to take care about is the risk of overflows if the value becomes too large.   A few examples:           'Creating an instance         Dim myInt As New System.Numerics.BigInteger           'It could store the minimum Short...         myInt = Short.MinValue         '...or the maximum Long as...

posted @ venerdì 7 agosto 2009 01:02 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic ]

Sticky data tips in the Visual Studio 2010's debugger

The data tips feature is available since Visual Studio 2005. When the debugger is in break mode, they allow viewing the content of variables and object by simply passing the mouse pointer over the object we want to analyze. In Visual Studio 2010 this feature has been extended with a new functionality known as sticky data tips. Basically you can create some sticky notes containing your comments that you can keep on the editor area while debugging. Let's see now how it works. Imagine you have a breakpoint in the code and that you want to show up the data tip on a...

posted @ martedì 28 luglio 2009 00:21 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic ]

WPF: The drag'n'drop data-binding in Visual Basic 2010 Beta 1 - part four (Entity Framework)

This is the last post of the introductory small series about the drag'n'drop data-binding for WPF in Visual Studio 2010 Beta 1. We're going to discuss the same topic I presented in my previous blog post, this time focusing the usage of the ADO.NET Entity Framework as the data-source in Visual Basic applications. Basically we're going to create the same kind of application shown in the previous post using DataSets; this means that we'll create a master-details representation, with the ability of choosing customers from a ListBox and viewing related orders implementing controls for navigating the orders themselves.   So you can create a...

posted @ sabato 20 giugno 2009 18:23 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Windows Presentation Foundation ]

WPF: the drag'n'drop data-binding in Visual Basic 2010 Beta 1 - part three (DataSets)

In this blog post I'm going to retake what I discussed in the previous ones, regarding the new drag'n'drop techniques for WPF data-binding in Visual Studio 2010 Beta 1, specifically for Visual Basic applications. We saw how easy is creating applications for tabular data representations implementing the new DataGrid  control both using DataSets and Entity Data Models.   Now we're going to do something different and we'll take the advantage of the drag'n'drop data-binding for generating an interesting master-details representation. We'll begin working versus a DataSet based on a Microsoft Access database, as we did in the first blog post of this series. In the...

posted @ venerdì 19 giugno 2009 12:10 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Windows Presentation Foundation ]

WPF: the drag'n'drop data-binding with Visual Basic 2010 Beta 1 - (part two, Entity Framework)

In my previous post I introduced one of the new features available in Microsoft Visual Studio 2010, the drag'n'drop data-binding for WPF applications. In that article we saw how we can use this kind of technique versus DataSets and, in that particular case, using a Microsoft Access database for tabular data representations.    In this post I'm going to reach the same objective but this time we'll work using an Entity Data Model generated by the ADO.NET Entity Framework, versus a SQL Server database.   So, once Visual Studio 2010 Beta 1 is running, let's create a new Visual Basic project...

posted @ giovedì 18 giugno 2009 13:10 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Windows Presentation Foundation ]

WPF: the drag'n'drop data-binding in Visual Basic 2010 Beta 1 - part one (DataSet)

One of the most important new features that is available in Microsoft Visual Studio 2010 Beta 1 is the drag'n'drop data-binding for Windows Presentation Foundation applications which works very similarly to what we already knew about Win Forms.   We discussed about this new features in the interview I made to Milind Lele from Microsoft during the MVP Global Summit 2009, so my goal is showing something more about this topic. Obviously, this kind of data-binding could need some additional code or additional manual steps to improve the result. In real life scenarios you will probably implement techniques such as the...

posted @ lunedì 15 giugno 2009 20:36 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic Windows Presentation Foundation ]

Customizing the Visual Studio 2010 Start Page with WPF

As you surely know, Visual Studio 2010 Beta 1 is available as a public download. One of the most important new features is the Start Page, which is now completely written in WPF.   The following picture represents the Start Page when you first run Visual Studio 2010 Beta 1: The goal of this post is explaining how you can customize the Visual Studio 2010's Start Page using your existing skills of Windows Presentation Foundation. In fact, the Start Page is entirely written in XAML code!   The first step is opening the folder called C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE; inside this folder you'll find...

posted @ lunedì 25 maggio 2009 00:09 | Feedback (0) | Filed Under [ Visual Studio 2010 Visual Basic ]

WPF: localization foundations with Visual Basic

Localization can be an important improvement when developing applications. Windows Presentation Foundation offers to .NET developers the capability of localizing applications, even if this can be accomplished in a quite different way regarding what we are used to do in Windows Forms.   The first thing to be noticed is that, at the moment, localizing WPF applications is something that you can do manually. In fact there is just a command line tool and no support for visual designers. Even if this can appear annoying, in my opinion the localization in WPF apps is well...

posted @ venerdì 8 maggio 2009 00:09 | Feedback (0) | Filed Under [ Visual Basic Windows Presentation Foundation ]

XAML code snippets in Visual Basic 2008

As you probably know, Microsoft Visual Studio 2008 offers an important mechanism for reusable code snippets. This feature is not available for the XAML code editor in WPF applications. So if we need to use XAML code snippets, we can run external tools such as the Snippet Manager which allows draggin'n'dropping snippets versus the XAML editor. By the way, I personally like to have all that I need inside the IDE (if possible!). We could consider to take the advantage of an internal IDE feature such as the drag'n'drop of text onto Visual Studio's toolbox that is good also for XAML code snippets....

posted @ domenica 19 aprile 2009 15:33 | Feedback (296) | Filed Under [ Visual Studio 2008 Visual Basic Windows Presentation Foundation ]

ADO.NET Data Services: deleting entities with associations

Probably this topic is more generally related to the ADO.NET Entity Framework programming, but in my case this was an issue I was experiencing with the ADO.NET Data Services, exposing an entity data model (I recorded some videos about). Imagine you have a client application that sends a DELETE Http requests to a Data Service for deleting entities on the database. It's not unusual that your entity will have associations with other entities and so on. The "delete" action gets performed on the Entity Data Model, because this is just a .NET representation of the data source, but you'll probably get errors...

posted @ sabato 11 aprile 2009 12:04 | Feedback (0) | Filed Under [ Visual Basic Windows Communication Foundation ]

WPF: Master-details sample with a customized DataGrid and Visual Basic 2008

In my previous blog post I discussed about creating a small "master-details" example within a WPF application, writing Visual Basic code. We learnt how setting up the new DataGrid control from the WPF Toolkit for presenting and editing data using the default layout.   The DataGrid is a flexible control. It allows to customize columns so that the UI gets more user friendly. This is accomplished customizing cells' template. There are some native templates, such as the following:    ·         DataGridTextColumn, which allows viewing/editing text; ·         DataGridCheckBoxColumn, which allows viewing and settings boolean value via a CheckBox; ·         DataGridComboBoxColumn, which allows selecting values to be...

posted @ venerdì 3 aprile 2009 15:36 | Feedback (0) | Filed Under [ Visual Basic Windows Presentation Foundation ]

WPF: master-details sample with the DataGrid control and Visual Basic 2008

The WPF Toolkit, an open source controls library that completes the standard ones offered by WPF, exposes a new DataGrid control for WPF developers working on .NET Framework 3.5 SP 1. Before going on reading this blog post, you'll need to download and install the WPF Toolkit.   In this post I'd like to show you how to build a simple master-details sample built on the top of the ADO.NET Entity Framework and using the DataGrid for presenting and editing tabular data. In our code example we'll retrieve the customer's list for our virtual Northwind Traders company and...

posted @ venerdì 3 aprile 2009 14:47 | Feedback (0) | Filed Under [ Visual Basic Windows Presentation Foundation ]

A WPF client for the Windows Azure Blob Storage with Visual Basic

If you are interested in developing applications for the clouds and you have signed up for an account on the Windows Azure Services Platform, you might have noticed that uploading files to the Blob storage is not immediate. Of course you could take advantage from the source code shipped with the Azure SDK for programmatically managing blobs. To make things easier, I decided to create my own client for managing files on my Blob storage and I did it with Visual Basic 2008 and Windows Presentation Foundation. The source code for this application is available on CodePlex and you can find it by...

posted @ martedì 17 marzo 2009 23:57 | Feedback (0) | Filed Under [ Visual Basic Windows Presentation Foundation Windows Azure ]

WPF: implementing a LinkLabel control with XAML and VB code

As you may know, Windows Presentation Foundation doesn't offer a LinkLabel control as instead happens in Windows Forms. By the way, creating a custom LinkLabel control in WPF is a simple task. This is because in WPF user controls are essentially the aggregation of primitive controls. We can start from a Label control; its content will not be just text but an HyperLink control. Let's consider the following XAML code snippet, which reaches the objective sending to my MVP profile:         <Label Width="150" Height="30">             <Hyperlink NavigateUri="https://mvp.support.microsoft.com/profile/Alessandro.Del%20Sole"                        Hyperlink.RequestNavigate="Hyperlink_RequestNavigate" >                 <TextBlock Text="Alessandro Del Sole" />             </Hyperlink>        ...

posted @ giovedì 12 marzo 2009 18:10 | Feedback (0) | Filed Under [ Visual Basic Windows Presentation Foundation ]

WPF: retrieving images metadata with Visual Basic 2008

Windows Presentation Foundation offers an abstract class called BitmapDecoder, which allows obtaining a reference to an image file (even multiframe) and representing the content of each frame.   Once we get this kind of reference to the image, we can retrieve also image's metadata. In fact we know that modern cameras or imaging applications add to each image file some additional information (the metadata themselves). Examples of metadata are the date when the picture is taken, the camera manufacturer, comments, author, subject.   To retrieve this kind of information, in WPF we can use a class called...

posted @ martedì 10 marzo 2009 01:00 | Feedback (0) | Filed Under [ Visual Basic Windows Presentation Foundation ]

WPF: an extension method for converting IEnumerable(Of T) into ObservableCollection(Of T)

When working with data-binding in Windows Presentation Foundation applications, the most appropriate collection for manipulating data is the ObservableCollection(Of T) because it allows the so called "two ways" data-binding. Changes made versus the collection are automatically reflected to the UI, because it implements the INotifyPropertyChanged interface, moreover it supports adding, removing and editing data. And, of course, changes made by the user via the UI are automatically sent back to the collection itself. It's not unusual to use LINQ for getting data that we want to bind to the user interface. Anyway, LINQ typically returns IEnumerable(Of T) or IQueryable(Of T) (which derives from IEnumerable) and...

posted @ lunedì 16 febbraio 2009 20:32 | Feedback (0) | Filed Under [ Visual Basic Windows Presentation Foundation ]

WPF: Using the WebBrowser control in Visual Basic code

.NET Framework 3.5 Service Pack 1 has added to Windows Presentation Foundation, among several additions, a new WebBrowser control which is very similar to the one provided by Windows Forms and that allows navigating Web pages, HTML documents and anything we could do with the Win Forms one.   It's very easy to use this control, so this is what we're going to see in this post. I created a simple demo application using Microsoft Visual Basic 2008 Express Edition. After creating a new WPF project for Visual Basic, our purpose is implementing a very simple UI where there are...

posted @ sabato 7 febbraio 2009 17:49 | Feedback (0) | Filed Under [ Visual Basic Windows Presentation Foundation ]

WPF: Styling controls at runtime in Visual Basic code

In WPF applications we usually assign styles or control templates to user controls in XAML code. This is the typical situation when you have a predefined number of controls in the user interface. But sometimes there are situations where you will need to instantiate user controls at runtime in Visual Basic code so you could also need to assign styles at runtime.   Let’s make a simple but practical example. Suppose you have a simple style that you declared inside the window’s resources:       <Window.Resources>         <Style x:Key="myStyle" TargetType="Button">             <Setter Property="Width" Value="100"/>             <Setter Property="Height" Value="30"/>             <Setter Property="Margin"...

posted @ mercoledì 21 gennaio 2009 18:17 | Feedback (0) | Filed Under [ Visual Basic Windows Presentation Foundation ]

Master-details forms with the ADO.NET Entity Framework

If you are a little bit familiar with LINQ to SQL, you probably already know how simple is creating a basic Windows Forms application for exposing one-to-many relationships between entities via master-detail representations through the UI.   In LINQ to SQL this can be accomplished using the Microsoft Visual Studio 2008 automation engine that allow dragging and dropping objects (entities) from the Data Sources window onto the target form. The IDE then adds the needed UI controls, manages the data-binding leaving to us the only job to specify in code the data source regarding the “one” part in the relationship.   Unfortunatley...

posted @ martedì 20 gennaio 2009 13:02 | Feedback (0) | Filed Under [ Visual Basic LINQ/EF/OData ]

Strongly typed eager loading in Entity Framework with Visual Basic

In a previous post we discussed about creating data forms for showing master-details data representations with Visual Basic 2008 and the ADO.NET Entity Framework and we said that using strings within the eager loading technique could cause the loss of the benefits provided by the LINQ strongly typed approach.   I then found a blog post by Matthieu Mezil (Microsoft Visual C# MVP), who solved the problem implementing a custom Include method using lambda expressions instead of strings, taking the advantage of the strongly typed approach. Matthieu's code is in Visual C# with his help we converted the code into Visual Basic...

posted @ lunedì 19 gennaio 2009 23:59 | Feedback (0) | Filed Under [ Visual Basic LINQ/EF/OData ]

WPF and the Handles keyword

When developing WPF applications with Visual Basic 2008 you may encounter a particular problem due to the bad usage of the Handles clause in events handling. In other words, if you assign an event handler to an user control in XAML code and then you specify an Handles clause for the same user control when writing the event handler, the event is handled twice and the consequences can be dangerous. For example, let's consider the following XAML code which just declares a button:         <Button Width="100" Height="30" Name="Button1" Click="Button1_Click" /> As you can see, I assigned an event handler to the control....

posted @ giovedì 15 gennaio 2009 22:53 | Feedback (0) | Filed Under [ Visual Basic Windows Presentation Foundation ]

WPF: sizing controls from other controls via databinding

During the last days inside the Visual Basic Tips & Tricks community forums we discussed about sizing Windows Presentation Foundation controls starting from other controls' size, using data-binding and XAML. Particularly an user asked how he could dinamically assign the width of a ProgressBar starting from the width of a Label, so that both controls could always have the same width. In this post I want to show you the solution I proposed and I'll demonstrate also how controls' width is updated at runtime with Visual Basic code. So we're talking about a WPF project in Visual Basic 2008. We have a simple grid:        ...

posted @ mercoledì 7 gennaio 2009 00:29 | Feedback (0) | Filed Under [ Visual Basic Windows Presentation Foundation ]

Creating and consuming WCF services with VS 2008 Express Editions - part two

In my previous post we saw how to utilize Microsoft Visual Studio 2008 Express Editions to create and consume Windows Communication Foundation services: Visual Web Developer 2008 for the first task and Visual Basic 2008 for the second one, observing how VWD does all the "dirty" work to publish the service to Internet Information Services.   In this post we want to use exclusively Visual Basic 2008 Express, reconstructing from zero the project. After starting VB 2008 Express, the first step to cover is creating a Class Library project that we'll call WcfExpressTemplate. Once ready, to the project must be added two...

posted @ venerdì 2 gennaio 2009 19:43 | Feedback (0) | Filed Under [ Visual Basic Windows Communication Foundation Visual Studio Express Editions ]

Creating and consuming WCF services with VS 2008 Express Editions - part one

A question that I've often read inside the Visual Basic Tips & Tricks community forums is: "how do I create and consume WCF services if I have only Visual Studio 2008 Express Editions?". So in this post and in the next one we'll see right how to accomplish this. In this first post we'll see how to use Microsoft Visual Web Developer 2008 Express Edition to create a WCF service and Visual Basic 2008 Express Edition to consume the service, while in the next post we'll see how to use just Visual Basic 2008 to reconstruct the WCF service, publish to IIS and, consume...

posted @ venerdì 2 gennaio 2009 19:18 | Feedback (0) | Filed Under [ Visual Basic Windows Communication Foundation Visual Studio Express Editions ]

WPF: Printing FlowDocuments in Visual Basic 2008

In a previous post we saw how easy is printing Windows Presentation Foundations UI controls. But probably the most common scenario is printing documents, another simple task in WPF.   Also in this case we recur to the PrintDialog class but now we'll use a method called PrintDocument. In fact it's possible to call it for printing FlowDocument objects, a particular kind of dynamic WPF documents.    Let's start from the base, a un FlowDocument that will contain, in this particular example, some text taken from my Italian language article about the ADO.NET Data Services on the VB T&T community. Once you create...

posted @ venerdì 2 gennaio 2009 18:52 | Feedback (0) | Filed Under [ Visual Basic Windows Presentation Foundation ]

WPF: printing UI elements with Visual Basic 2008

Printing UI elements in Windows Presentation Foundation is a simple task. This can be accomplished via a method called PrintVisual from the PrintDialog class. This last class exposes, as you can imagine, the classical Print dialog and has a method called PrintVisual which can send to a physical o virtual printer any object of type System.Windows.Media.Visual like e.g. the most of WPF controls which are derived from it.   So let's see a very simple code example. In a WPF application created with Visual Basic 2008, the following XAML defines a simple grid with two rows; the first row...

posted @ venerdì 2 gennaio 2009 17:38 | Feedback (0) | Filed Under [ Visual Basic Windows Presentation Foundation ]

Powered by:
Powered By Subtext Powered By ASP.NET