Referencing a dll and then calling a dll function

jbl_ks

Member
Joined
Dec 16, 2010
Messages
24
Programming Experience
Beginner
I have compiled a C# class as a .dll named TileCalculations.dll
Within the Class its namespace is TileCalculations and the Class is TileSystem

namespace TileCalculations
{
static class TileSystem

I have attempted to add this to a vb.net poject using Project > Add Reference and navigating to that file and selecting this dll. I see the dll in my Project Properties Window and the Local Copy property is set to True.

I have included the following:

Imports System.Net
Imports System.Diagnostics
Imports System.IO
Imports System.Math
Imports System.Text.RegularExpressions
Imports System.Threading.Thread
Imports System.Text
Imports System.Drawing
Imports TileCalculations

An example Function in that Class is:
/// <summary>
/// Determines the map width and height (in pixels) at a specified level
/// of detail.
/// </summary>
/// <param name="levelOfDetail">Level of detail, from 1 (lowest detail)
/// to 23 (highest detail).</param>
/// <returns>The map width and height in pixels.</returns>

public static uint MapSize(int levelOfDetail)
{
return (uint)256 << levelOfDetail;
}

How do I call the function MapSize. I am trying;

Dim intmyValue As Int32 = MapSize(17) ' should equal 33,554,432

I get a message 'MapSize' is not declared. It may be inaccessible due to its
protection level.
 
VB.NET:
= TileSystem.MapSize(17)
You also haven't set any access level on that class so it will be default. You should set the access level explicitly to avoid misconceptions. Look up 'access modifiers' the help if you're unsure about these.
 
Back
Top