Skip to main content

C# – Consume a WebService – Check VAT numb

webservice - cloud in the sky

Here is a simple example of how to consume a WebService in a console app with C#. For this tutorial, we will use the free service from the European commission you can use to validate tax (VAT) number. Here is the web interface: http://ec.europa.eu/taxation_customs/vies/ First of all, create a new console application (named CheckVat) and add a new […]

WPF – MVVM DataTemplateSelector

Hello devz, Let’s say that you want to create your UI but in a dynamic way. Let me explain. Imagine a view which is based on a list of items you want to display. But this list can vary (depending on rights, or context). In this simple example, we want a label with a textbox, then […]

WPF – Paste Clipboard content from Excel t

copy paste

Hello Devz, Manipulating the clipboard content is pretty easy. But it can become handy when pasting it in a GridView. Here a simple example on how to paste the content of the clipboard from Excel to a GridView. First things first! Here is how to use the clipboard:

Obviously you could use the SetText(string) method […]

WPF – MVVM TextBox Validation with IDataEr

WPF UI Data Validation

Hello Devz, This post will describe how to do a simple MVVM TextBox validation with IDataErrorInfo. UI Data Validation is an important part of the FrontEnd creation. The FrontEnd should always be backed up by the BackEnd validation! But here we will focus only on the FE part. Before showing the code, you have to […]

WPF – Enum Binding With Description in a C

Enum Binding with Description in a ComboBox - WPF MVVM

Hello Devz, In my two previous posts, I was talking about how to bind an enum (the classic way and the other way). But these have two major issues. First, all the items from the Enum will be bound and displayed. And sometimes you don’t want to display all of them (like ‘None’). Secondly, you […]

WPF – Enum Binding in a ComboBox – The Cla

Enum binding to combobox

Hello Devz, I had to write this post about how to do an Enum binding to a ComboBox, because everytime I need it, I’m surprised there is no “out-of-the-box” solution provided in WPF or Xamarin.Forms.

Please notice this line: xmlns:sys=”clr-namespace:System;assembly=mscorlib” And the ObjectDataProvider in the Window.Resources. With a simple Enum called StatusEnum:

So this was the […]

C# – Aspose.Cells – Create Excel files wit

Excel plus Aspose

Hello Devz, It is common to have to export data to an Excel file. But sometimes the code have to run on a server where Excel is not or can’t be installed. And anyway, to be honest the Excel Interop is a real piece of crap to use… So Aspose did a good work by […]

C# – SI prefixes for metric units – becaus

units - SI prefixes

Sometimes you will have to play with numbers, BIG numbers… Or teeny-tiny ones! To avoid having too many zeros you can use the SI prefixes (like metric units: mm, cm, m, km, …). Here are the results of our code:

And here is the helper:

Now if you need to specify the decimal separator as a […]