Startsidan  ▸  Texter  ▸  Teknikblogg

Anders Hesselbom

Programmerare, skeptiker, sekulärhumanist, antirasist.
Författare till bok om C64 och senbliven lantis.
Röstar pirat.

Category: Visual Basic 9

Drag and drop GDI+ objects on a Panel
2010-11-04

This adventure takes place on a Panel that resides on a Form. I have a class that represents a GDI+ object (Thing). The Draw method that does the graphical representation of the object is very, very primitive, just enough to make it visible. Pub [...]

Keep track on USB devices
2010-10-14

Microsoft provides a library for talking to USB devices as part of the .NET Framework. This is just one thing you can do with the versatile System.Management namespace. If you want to keep track on the units that are connected or removed from a compu [...]

Compressing a web request
2010-09-12

Perhaps you remember my old GZip example that illustrated how to use the GZip compression feature of the .NET Framework. To follow, read the Main function. It starts with a 118 character string that is compressed to a array of 208 bytes, than decompr [...]

Writing a game using TurboSprite (2/2)
2010-07-19

Continued from here. Now I want to enable shooting. When the user presses the Control key, I create a bullet, sets its properties and adds it to the engine. This code is added to the KeyDown event. I have to modify the KeyUp event, because in the [...]

Writing a game using TurboSprite (1/2)
2010-07-19

There are two things to take away from this post. The ease of TurboSprite and the power and speed of GDI+. Of course, you are still supposed to write games using hardware acceleration, but you can do decent desktop games without DirectX, XNA or OpenG [...]

TurboSprite
2010-07-15

TurboSprite is a software driven (GDI+) sprite engine written by Dion Kurczek in C#. The reason that I'm picking this up, is that it shows (like I have mentioned before) the amazing capabilities and performance of the GDI+ library in .NET. TurboSprit [...]

Decompressing text
2010-06-12

This post shows how to compress a String to reduce the amount memory it consumes, and this post shows how to use the CompressText function. To be able to read the content of the string, it must be decompressed (or inflated) again. The DecompressText [...]

Inserting a value in an identity column
2010-05-25

In SQL Server 2008, when a column is set to auto increment (Identity Specification), you are normally not allowed to give that column a value. If you are copying data from one database to another in Visual Basic, perhaps by loading a DataSet object u [...]

Easy handeling of command line arguments
2010-04-01

The CommandLineArguments class is a useful tool when you are building an application that accepts different arguments from the command line, and argument with parameters. The class lets you check if the program was started using a specific argument, [...]

Filtersearching a Data Grid View
2010-03-09

Some applications have that cool search feature that filters on what you search for, and displays the result in real time. The data that you are searching in is loaded, and then the record(s) that matches your search from that set of data is display. [...]

Connecting to MySQL from Visual Basic
2010-03-06

If it is in your control, stay with SQL Server! If it isn't, this is how you can do it. When you install the .NET Connector for MySQL, a class library called MySql.Data is installed. You can add a reference to it from the Add Reference dialog. Thi [...]

Automatic object duplication
2010-02-13

While working on my new Monkeybone control, I was on my way to create an abstract base class that declared a function called Copy for duplicating a drawing instruction. My plan was that each instruction (such as a Line or a Bar) had to provide an imp [...]

Deboxing undercover
2010-02-04

This just don't look right to me: For Each X As SomeType In ComboBox1.Items ...some code... Next Items in a combo box is an ObjectCollection, so I usually do the extra step of using an Object as interator in my For Each iterators to avoid [...]

Compressing Genesis
2009-11-22

From here, I have downloaded Genesis to see what the GZip stream is good for. GZip is suitable for compressing text, because the file format is totally clean (uncompressed) and the Deflate algorithm manages therefore to compress text to a high ratio. [...]

Compressing text
2009-11-13

I had a situation today when I had to fit about 12.000 bytes of text in 5.000 byte storage. In .NET, this is so easy to do. Just a few lines of code is required to convert a long String to a short Byte array. Examine the CompressText function. This p [...]

Referring to a function
2009-10-14

Delegates are used to refer to a function. You define a delegate class (one row) using the keyword Delegate, and when it is created, or instantiated, the instance refers to a function. The code that reaches the delegate instance, can call the functio [...]

Functions: Passing by value and by reference
2009-10-10

This is really one of the simplest concepts ever, but since this is something that you need to know as well as something you can benefit from knowing, I think it can be worth a post. Consider this this code: Class MyProgram Shared Sub Mai [...]

Functions: Shadowing
2009-10-09

Over the years, functions has grown to become a quite complex and flexible feature in Visual Basic. The striking flexibility of the parameters, the modifiers that can apply a function and the function attributes, gives you great possibilities when yo [...]

My and Microsoft.VisualBasic namespaces
2009-09-27

I never use the Microsoft.VisualBasic namespace, and I don't think that it is there for other purposes than backwards compatibility with Visual Basic 6, with the possible exception of flirting with people who think this (C#)... Interaction.MsgBox( [...]

Execute a cmdlet or PS1 script from Visual Basic
2009-08-10

The cmdlets in PowerShell can easily be executed from within Visual Basic. I have done this in a few Visual Basic 8 projects, and the code for doing this from Visual Basic 8 can be somewhat ugly, but in Visual Basic 9 (and .NET Framework 3.5) it is v [...]

Another moderate introduction to deep support for xml
2009-07-31

This post is more of a reminder to my self to start to deep xml support more seriously. I have mentioned it before, but not really examined it yet. For some reason, being free from work, leaves me with less time to just code for fun, compared to when [...]

More on late binding
2009-07-13

How about an example on how to use scripting capabilities in your application, if the script control is available, without setting any references? 'Attempt to get the type for the script control. Dim ScType As System.Type = System.Type.GetTypeFromP [...]

Images: EnsureMaximumSize
2009-06-27

I have added a new function for resizing with maintained proportions to my image class WsImage.Image. The name is EnsureMaximumSize, and it takes one integer (the maximum width or height) and returns a boolean. The return value is True if the image s [...]

Shadowing
2009-05-12

One feature that I use every day, really every day, in Visual Basic is shadowing. Like the keyword "new" in C#, it is used to override a method that is not overridable, but unlike the new keyword, shadowing replaces all overloads of a function in the [...]

The differences, part 2
2009-05-04

Visual Basic 9 and C# 3.5 has much in common, and I suspect that they will differ more in the future. I have pointed out some current differences, like completion lists, object initializers, deep XML support and declarative events. A few more VB-sp [...]

The differences, part 1
2009-04-26

Visual Basic and C# is mainly the same thing today. I imagine that Microsoft have a slightly different vision on what they the languages to be, and these differences might be even more clear in future versions. Version 9 of Visual Basic has a few fea [...]

Completion lists
2009-04-12

Completion lists is one of the nice features that you can use in Visual Basic 9 to help programmers to initialize objects. In a way, this works like enumerations, but enumerations are really named integer values, and a completion list can consist of [...]

Anonymous methods
2009-01-26

Delegates can point to both anonymous functions (mostly refered to as anonymous methods) and regular functions. To instantiate a delegate that will point at a regular function, just use the AddressOf operator followed by the function you want to use [...]

Compile options in VB9 – compare and infer
2008-12-13

These options can also be set for all modules in the project settings window, or for each file in code. If the settings are in conflict, the setting written in code overrides the project setting. Option compare This option simply tells if strings [...]

Compile options in VB9 – explicit and strict
2008-12-13

Compile options can be set for all source code files at the same time in the project file, and they can be overridden in each file. If you want to override a compile option for file, just make sure that the compile option(s) are the first line(s) in [...]

Substitute values in ASP.NET
2008-12-13

It is very easy to present data on a web page using Visual Studio. I want to give a suggestion on how to present a substitute for a value. For this example, I use Visual Studio 2005 and SQL Server 2005.   Imagine a database (TestDatabase) with a t [...]

Session state in .NET 3.5
2008-12-13

 This new feature saves some time, but for me, it took a while to figure it out. Or to be honest, after a while, I gave up and asked my personal guru Roger. This is the thing:In web services, to preserve session state (that is, being able to read and [...]

Relaxed delegates, how?
2008-12-13

The basic concept of delegates is this: Like a class, you can create instances from a delegate. An instance of a class can represent anything, but an instance of a delegate can only represent a method. A class has a body, a delegate does not need one [...]

Using Linq to locate a codec
2008-12-13

In a previous post, I mentioned that Linq could be used to locate the desired codec when you're saving an image. Instead of iterating through the codecs, and halt when the right one shows up, I could just select the desired one.  This is what I wa [...]

New object initializer
2008-12-13

Visual Basic 9 has a new object initializer. This is the point: Any variable that the code creating the instance can reach, can be initialized using the initializer. This is an example class. It has two public data members (X and Y). Since they are p [...]

Deep XML support
2008-12-13

Deep XML support means that the Visual Basic compiler knows what XML is, in about the same way that it knows what a Visual Basic keyword or a string constant is. Since all objects in .NET have a ToString function, wherever you used to use a string wi [...]



En kopp kaffe!

Bjud mig på en kopp kaffe (20:-) som tack för bra innehåll!

Bjud på en kopp kaffe!

Om...

Kontaktuppgifter, med mera, finns här.

Följ mig

Twitter Instagram
GitHub RSS

Public Service

Folkbildning om public service.

Hem   |   linktr.ee/hesselbom   |   winsoft.se   |   80tal.se   |   Filmtips