I have consistently encountered an error when trying to use Meshes with the newer versions of D3D9. So, at the moment, this article is only for the old versions of D3D9. Now, we're going to add meshes into our 3D world. Meshes are simply pre-constructed 3D models that we can import into our DirectX application. X files can be created by applications such as Milkshape or, if you have an extra arm, 3DS Max. I have a few simple ones for demonstration purposes.
To load a mesh, we, of course, need a declaration for the mesh. Since we will also need to load textures and materials for the mesh, we set up an array of those:
    Dim MasterMesh As Mesh
    Dim MMMtrls() As Material
    Dim MMTxtrs() As Texture
Now, to actually load our mesh into existence - if we do not need to use the texture or material in the mesh, we can load the mesh using the easy Mesh.FromFile:
        MasterMesh = Mesh.FromFile(Application.StartupPath & "\tree.x", MeshFlags.SoftwareProcessing, D9)

        'You can use the one above if you have a material and texture that you will be supplying to the mesh.

        'However, the material and texture can be included within the .x file.
But if we actually have materials and textures in the file that we want to use (which is usually the case), we need to load those when we load the .x file. This is aided by an array of extended materials which gets filled if you pass it into the .FromFile function:
        Dim Ems() As ExtendedMaterial, LV As Integer
        'Merely holds a material and a filename for a texture.

        MasterMesh = Mesh.FromFile("C:\tree.x", MeshFlags.Managed, D9, Ems)
        'Loads the mesh from file.  .x data goes into the Extended Material array.
And now, you have an array of ExtendedMaterials, which merely contain a material and a filename for a texture. Now, we fill in our material and texture array. Note: your textures should exist in the same folder as the mesh.
        'The number of entries corresponds to the number of materials and textures.
        MMMtrls = New Material(Ems.GetUpperBound(0)) {}
        MMTxtrs = New Texture(Ems.GetUpperBound(0)) {}

        For LV = 0 To Ems.GetUpperBound(0)
            MMMtrls(LV) = Ems(LV).Material3D
            'Set the material.  3D means DX3D.

            MMMtrls(LV).Ambient = MMMtrls(LV).Diffuse
            'Ambient property is lost within the loader or in the .x file.
            'But anyway, this property must be set in VB, otherwise your textures will be black when unlit.

            MMTxtrs(LV) = TextureLoader.FromFile(D9, Ems(LV).TextureFilename)
        Next

        'All of this information will be used when drawing the mesh.
Why would we have an array? Certain meshes are arranged in groups (called Subsets within DirectX) that may have different properties from the other subsets. For instance, the tree model has a subset for the actual bark of the tree (the bottom) and another subset for the leafy part of the tree (the top).
Now, to draw our mesh - since our mesh may be composed of several subsets, we need to draw each subset one by one. In addition, before we draw our subset, we need to apply the correct material and the correct texture before we draw our subset so that our subset appears as we expect it to.
        For LV = 0 To MMMtrls.GetUpperBound(0)
            D9.Material = MMMtrls(LV)
            'Set the appropriate material for this subset.
            D9.SetTexture(0, MMTxtrs(LV))
            'And the appropriate texture.

            'Then draw the mesh subset.
            MasterMesh.DrawSubset(LV)

        Next

.vb file