Category Archives: Visual Basic

Instruct T4 to use C# v3.5

Consider this simple T4 template: <# for (var i = 0; i < 10; ++i) { WriteLine("hello"); } #> Trying to build the project results in a compilation error because ‘var’ is an unknown type. A bit of research learned … Continue reading

Posted in C#, Visual Basic | Leave a comment

Access a control by name

I know a mathematician that can do magic with stats. That’s also the reason why he works at Eurostat. He’s automating a lot of his work by programming in Visual Basic for Applications. He asked me if i wanted to … Continue reading

Posted in Visual Basic | Leave a comment

Removing selected items from a ListBox

Today i was experimenting with a couple of windows controls. For some reason i wasn’t able to remove the selected items from a ListBox. Here is the code that didn’t work: For Each index As Integer = ListBox1.SelectedIndices ListBox2.Items.Add(ListBox1.Items(index)) ListBox1.Items.Remove(index) … Continue reading

Posted in Visual Basic, Windows Forms | 2 Comments