0

How to display a mathematical formula in a form and in a messagebox?

I found an article to enable users to Write Math Equations in a Web Even though there includes a vb.net version I can make it to work on visual studio 2010 for a desktop app

I have seen it uses:

  [System.Runtime.InteropServices.DllImport("MimeTex.dll")]
    internal static extern int CreateGifFromEq(string expr, 
                                             string fileName);

But how to do analog for vb.net?

I know I have to include

Imports System.Runtime.InteropServices

then

Friend Class NativeMethods
        <DllImport("MimeTex", CharSet:=CharSet.Auto, SetLastError:=True)> _
        Public Shared Function CreateGifFromEq(ByVal expr As String, ByVal fileName As String) As Integer
        End Function
    End Class

but I get:

Error   1   'CreateGifFromEq' is not declared. It may be inaccessible due to its protection level.  

when using

 CreateGifFromEq("((x+4+9+8)/2)*0.8", "image.png")

Is there a way to draw equations and show it in a messagebox?

edgarmtze
  • 24,683
  • 80
  • 235
  • 386

1 Answers1

1

MimeTex is an external library which you have to add to your project. You can download it from the original site (it is written in C++) or just use the DLL in the source code of the application you refer, which you can download from the link you are providing. Not sure about its reliability neither about its exact applicability to VB.NET winforms. The best thing you can do (additionally to some research) is executing the source code in the link, confirming that it works as expected and adapting it to your needs.

If you want to write equations, there seems to be quite a few alternatives. After a quick research I found this post in SO: it refers to C# but the links given in the answers are fully applicable to VB.NET.

Community
  • 1
  • 1
varocarbas
  • 12,354
  • 4
  • 26
  • 37