Topics
-
-
- Administrators
- 1 reply
- 41.3k views
Quick Guide to Parametrising SQL Jump to the bit on using parameters Often when interacting databases we need to provide information to the database that can only be obtained at runtime (this could be from user input, other programmatic means or similar). Two potential approaches to this problem involve either parametrising the database code or relying on string concatenation. In this post I hope to show why concatenation is bad and parameters are good. To keep things simple I am using the simplest code I can and deliberately ignoring non-essential error handling, for similar reasons I am also choosing not to use stored procedures. I am choosing Northwind as t…
Last reply by PlausiblyDamp, -
-
-
- Leaders
- 0 replies
- 7.5k views
I've seen certain questions asked a number of times and decided that it would be appropriate to have some reference that clearly explains the details of this tricky aspect of function calls. To get the most out of this you should understand the concept of pointers and the difference between value-type objects and reference-type objects. Pointers, Pointers Everywhere Like traditional VB, DotNet languages (C++ aside, this article will focus on VB and C#) do an excellent job of hiding pointers from the programer, despite the fact that they are a very fundamental aspect of DotNet programming, used with reference types, pass-by-reference parameters, Delegate objects, and u…
Last reply by snarfblam, -
-
-
- Leaders
- 1 reply
- 8.8k views
A few people have asked about bitmap manipulation recently. The biggest problem with GDI+ is that it can be pretty slow, especially on color-based per-pixel operations, since the only easy means of doing this is with the GetPixel/SetPixel function pair, which is slow This tutorial explains how to lock bitmaps and more directly access the data to give your app a huge performance boost. Code examples and samples are given in C#, but a language-neutral approach was taken (no pointers) so that the code can easily be converted to VB or C++ and is verifiable by the runtime. http://ilab.ahemm.org/tutBitmap.html Comments are welcome, here or by e-mail. Enjoy. Or don't. W…
Last reply by snarfblam, -
-
-
- Leaders
- 0 replies
- 12.9k views
This is just an overview of what a good DotNet programmer should know about garbage collection and disposable objects, prompted by this post. Garbage Collection There are plenty of thorough articles about garbage collection, so I will only quickly cover the basics. All class objects, or "reference type" objects, are tracked by the garbage collector. At certain points that the garbage collector deems safe, execution of a program is halted and the garbage collector identifies which objects are reachable and which objects aren't. This is done by starting at certain "roots" and tracing references to see which objects are still connected to the program one way or anothe…
Last reply by snarfblam, -
-
C++ offers a special kind of type that is not present in C#: a union. For anyone who is not familiar with unions, here is a quick explanation of how they work and what they're good for. How They Work A union is somewhat like a struct. A union definition defines a type. A union type has fields and methods like a struct. The key difference is that a union stores all of its fields in the same memory location, whereas a struct stores each field in a different memory location. http://ilab.ahemm.org/imgHost/nonunion.gifhttp://ilab.ahemm.org/imgHost/union.gif What they are good for The primary use for a union is to conserve memory. Because the fields are stored in …
Last reply by snarfblam, -
-
- Leaders
- 0 replies
- 7.1k views
Questions regarding on-the-fly control creation are not uncommon. Even when people figure out how to create controls, there is often difficulty and confusion with event handling and referencing controls. This tutorial explores the basics of dynamic control creation and addresses some common issues. Example code is provided in both C# and VB for .NET versions 1.0-2.0, and a Visual Studio 8 demo project is included for both languages. Tutorial C# Demo VB Demo Suggestions and comments welcome.
Last reply by snarfblam, -
-
- 3 replies
- 5k views
For starters it's a good idea to understand the definition of a String in the land of Microsoft and .NET. - Microsoft Developer Network What this roughly means is that every time you write code like this 'I am using VB because it formats the best in this forum. Dim MyString as String = "" For i as Integer = 0 to 99999 MyString &= "x" Next i the OS has to re-allocate memory for the string 100,000 times, this is very inefficient. Don't despair, there is hope we have the System.Text namespace, which includes the StringBuilder class. - Microsoft Developer Network This means the same code as above (slightly altered) 'I…
Last reply by IngisKahn, -
- 0 replies
- 18.8k views
With help from this forum I was able to figure out the double buffer solution using gdi32's BitBlt in C#.net. GDI+ is well known for its lack of speed in the performance arena. To solve the "flicker" solution, and add a fast back buffer to my application, i dipped back into gdi32. What you'll want to do is this.. On your form, create a picturebox that will show your live drawing. Lets call it picChart. Now, what we need to do is create a back buffer for our picChart. private Bitmap memBmp; // Backbuffers bitmap private IntPtr hMemBmp; // Handle to our memBmp private Graphics memDC; // We draw on this private IntPtr hMemdc; // Handle to our memDC private …
Last reply by qmp, -
-
- *Gurus*
- 1 reply
- 12.2k views
Visual Basic .NET Standard Edition doesn't come with very many project types, so I decided to add a few more using the VS.NET project scripting system. The .zip file below explains how to install the necessary files. They'll add "Class Library" and "Windows Control Library" to your list of available project types. Note: Files will need to be modified for non-English (1033) installations. newprojects.zip
Last reply by Derek Stone, -
-
-
- Administrators
- 0 replies
- 7.3k views
Guide to Object Orientated code in .Net This is a continuation of the series started in here and is preceded by this thread Introduction In the previous article we looked at how we could use inheritance to simply the creation of a SavingsAccount class, which contains additional functionality over the BankAccount class, with minimal need to duplicate code and no requirement to alter existing code to work with the new class. The ability to extend a class in this way can be very useful when developing software, however the ability to change how a derived class implements methods defined in the base class can be very powerful. Imagine our fictitious bank wishes to imp…
Last reply by PlausiblyDamp, -
-
- 0 replies
- 13k views
I will be making a set of 5 or 6 tutorials, each of which include source for Visual Basic.NET 2002 and Visual Basic.NET 2003. C# tutorials may or may not follow. These tutorials are to give you guys a jumpstart to some Direct3D. I hope you enjoy these. This tutorial will teach you how to remove that green background. Note: This tutorial is based directly off of my other tutorial: http://www.vbprogramming.8k.com/tutorials/TransparentSprites.htm I have posted a tutorial here for people who do not know my site. Intro This tutorial will be based off of the previous tutorial (Matrices and Transformations). So open up the project from that (you can download the sour…
Last reply by ThePentiumGuy, -
-
- Leaders
- 1 reply
- 6.1k views
I recently got a chance to check out VB2K5 and I like the new feature of being able to do Operator Overloading. I decided to write a little tutorial about it and I'm posting it here for others to see what it is like. The tutorial is in RTF format and can be found in the zip file attached (it was too long to post). I'm also including a complete project that deals with fractions in Visual Basic 2003 and Visual Basic 2005 for comparison. Both versions have been somewhat tested but if you find bugs please let me know. Enjoy OperatorOverloading.zip
Last reply by ThePentiumGuy, -
-
-
- Administrators
- 1 reply
- 8.7k views
Guide to Object Orientated code in .Net This is a continuation of the series started in here and is preceded by this thread Introduction So far we have looked at how we can define a class to encapsulate a simple business object and as part of this hide the internal details while providing a clean way for external code to utilise this class. In this article we will look at a concept fundamental to OO development � the idea of polymorphism. In this article we will discuss one method of achieving this (inheritance) and in a later one we will also look at an alternate, but complimentary method (interfaces). Benefits of our class so far The class we have been devel…
Last reply by PlausiblyDamp, -
-
- 1 reply
- 10.5k views
I will be making a set of 5 or 6 tutorials, each of which include source for Visual Basic.NET 2002 and Visual Basic.NET 2003. C# tutorials may or may not follow. These tutorials are to give you guys a jumpstart to some Direct3D. I hope you enjoy these. This tutorial will teach you how to move stuff around using Matrices and Transformations. Hey welcome to the next tutorial.. this is the tutorial that will start to confuse the hell out of you.. just know 1 thing: As long as you keep an open mind and a positive attitude you'll understand this ;p. Heh, lets start with a few Q and A to get the ball rolling The obvious question: "How do you move stuff??" The …
Last reply by ThePentiumGuy, -
-
- Administrators
- 0 replies
- 8.6k views
Guide to Object Orientated code in .Net This is a continuation of the series started in here and is preceded by this thread Introduction So far we have looked at creating a class that implements several OO concepts (Methods, properties, data hiding and overloading). In this article we will look at another feature � Constructors. Constructors One of the ideas behind OO code is that as much as possible we try to make code self contained and re-usable, one way to do this is to remove the need for people using our code to know how to initialise the internal data structures or require them to remember to call initialisation routines before using our code. In it�s…
Last reply by PlausiblyDamp, -
-
- 1 reply
- 15.2k views
I will be making a set of 5 or 6 tutorials, each of which include source for Visual Basic.NET 2002 and Visual Basic.NET 2003. C# tutorials may or may not follow. These tutorials are to give you guys a jumpstart to some Direct3D. I hope you enjoy these. edit: ARGH! Font got screwed up on this one. Stupid thing doublespaces it automatically. The source code got 'squished' together. I patched up as much of it as possible. Please bear with me, but the source code is fully commented and follows along with this tutorial - so it might be better to paste from there rather than here. This tutorial will teach you how to display a textured quad(square). In this tutorial we…
Last reply by ThePentiumGuy, -
-
- Administrators
- 0 replies
- 7.7k views
Guide to Object Orientated code in .Net This is a continuation of the series started in here and is preceded by this thread Introduction In the previous articles we have looked at a simple class that contains data and functionality. The data is simply stored as variables within the class for simplicity. The functionality of the class is exposed through three routines the Balance property and the Credit / Debit functions, in this article we will look at a bit of terminology and see how we can take advantage of some more .Net features. Class A class is a piece of code that defines the functionality of an aspect of our code, in the previous articles we have a simp…
Last reply by PlausiblyDamp, -
-
-
- Administrators
- 0 replies
- 8k views
Intro to OOP Part 2 Guide to Object Orientated code in .Net part 2 This post is a continuation of the one found here Introduction In the previous article we looked at how to create a simple class and saw how to then use the functionality it provided. In this article we will look at a feature that can make our coding life a little bit easier and our code a little bit cleaner. Properties One nice syntax feature .Net offers is the concept of a property � these can be accessed as if they were a simple public variable, but really are a function call. This means we get the best of both worlds � cleaner code syntax and the power of re-usable code. In the previous …
Last reply by PlausiblyDamp, -
-
-
- Administrators
- 0 replies
- 8.2k views
Guide to Object Orientated code in .Net Introduction This is intended as a guide on the features .Net provides in terms of Object Orientated Programming. This post will cover simple issues such as classes and structures as well as basic terminology used. Later articles will cover other areas such as interfaces and inheritance. Most of the code snippets are in VB.Net but C# will be shown if major differences occur and I will endeavour to include complete projects in both languages. Within .Net everything is an object from the most complex classes you design to a simple Boolean or Integer value .Net treats everything the same. To really understand how to best take ad…
Last reply by PlausiblyDamp, -
-
- 0 replies
- 18.3k views
Stored Procedures We have all heard the rallying cry for stored procedures. Compiled SQL on the server improves performance over pass-through queries because the SQL is, well, compiled. Performance gains are realized when parameters are submitted to the RDBMS server and injected into the query server-side as opposed to sending raw SQL strings built on the client-side, so the mantra goes. The .NET framework provides a good toolset for accessing Oracle data from within .NET code, although it pales in comparison to the SQL Server toolset. There are promises from Microsoft that improvements will be forthcoming in future versions. The Oracle .NET Data Provider…
Last reply by VBAHole22,
-
Who's Online 0 Members, 0 Anonymous, 10 Guests (See full list)
- There are no registered users currently online