locked
How to create a expansion for SmallBasic in VB.Net? RRS feed

  • Question

  • How can I create a expansion for SmallBasic in VB.Net?

    Wednesday, April 11, 2012 9:20 AM

Answers

  • The xml help should be created automatically if you add it in the code by typing /// (C#) or ''' (VB) before the method and adding information for the method, parameters and returns.

    Other points:

    1] You must target .Net 3.5 and enable XML output in the preferences.

    2] The project must be a class library (dll)

    3] The methods must use the Primitive type for all arguments and returns.

    4] The class must be adorned with SmallBasicType attribute

    5] A reference to SmallBasicLibrary.dll is required and an 'Imports' to the namespace Microsoft.SmallBasic.Library

    I have a pretty complete getting started guide and sample projects for C# here (very similar to VB).  See other resource downloads (Guide to writing extensions).  Perhaps consider C# (almost exactly equivalent to VB with syntax differences) and maybe more extension samples in C#.

    If you want to zip up the entire VS2010 VB project I am happy to take a look.

    Keep at it, it is all possible once you get the syntax and do all the required setup steps.

    In VB it might look like a bit like this (some from memory so there may be a small error).

    Imports System
    Imports Microsoft.SmallBasic.Library
    
    ''' <summary>
    ''' This class ...
    ''' </summary>
    <SmallBasicType()> _
    Public Module MyExtension
        ''' <summary>
        ''' My extension description
        ''' </summary>
        ''' <param name="Test">Test argument description</param>
         ''' <returns>The return is just the input parameter</returns>
        Public Function MyMethod(ByVal Test As Primitive) As Primitive
            Return Test
        End Function
    End Module
    • Edited by litdev Thursday, April 12, 2012 11:31 AM link corrected
    • Marked as answer by yoenmii Thursday, April 12, 2012 11:39 AM
    Wednesday, April 11, 2012 6:28 PM
  • [Q1]I think yes.

    [Q2]I try speech extension an it works good :).

    ___________________________________________________________________

    Problem solved!!!

    I changed the target to .Net Framework 3.5 but I click in cancel in a window that appeared after click in accept in the settings window. (This is the error)

    And other error I search by the name of the project no the class name.

    (HUMAN ERRORS ONLY - My errors-. NO SOFTWARE ERRORS)

    Many thanks for the help. You are the Microsoft Moderator who has helped me the most :D. Hopefully all Microsoft Staff were like you :D.





    • Marked as answer by yoenmii Thursday, April 12, 2012 11:39 AM
    • Edited by yoenmii Thursday, April 12, 2012 11:43 AM Problem Solved
    Thursday, April 12, 2012 11:02 AM

All replies

  • Start here, dowload VS 2010 Express, ILSpy and some of the extensions already about (some with source code VB or C#) - look how they are done, start simple, check out various theads on this forum and ask questions as you go.  Also write simple apps in VB directly first.
    • Edited by litdev Wednesday, April 11, 2012 2:53 PM
    • Proposed as answer by CodingLikeCrazy Wednesday, April 11, 2012 4:01 PM
    Wednesday, April 11, 2012 2:53 PM
  • I have already showed it and I develope a little extension but I can't use it in my project (And I can't saw it in the IntelliSense). The extension is compilated(name.dll) , I created a .xml(name.xml) file and I put them in a subdirectory(lib) in SmartBasic folder.

    Nothing here

    Wednesday, April 11, 2012 5:15 PM
  • The xml help should be created automatically if you add it in the code by typing /// (C#) or ''' (VB) before the method and adding information for the method, parameters and returns.

    Other points:

    1] You must target .Net 3.5 and enable XML output in the preferences.

    2] The project must be a class library (dll)

    3] The methods must use the Primitive type for all arguments and returns.

    4] The class must be adorned with SmallBasicType attribute

    5] A reference to SmallBasicLibrary.dll is required and an 'Imports' to the namespace Microsoft.SmallBasic.Library

    I have a pretty complete getting started guide and sample projects for C# here (very similar to VB).  See other resource downloads (Guide to writing extensions).  Perhaps consider C# (almost exactly equivalent to VB with syntax differences) and maybe more extension samples in C#.

    If you want to zip up the entire VS2010 VB project I am happy to take a look.

    Keep at it, it is all possible once you get the syntax and do all the required setup steps.

    In VB it might look like a bit like this (some from memory so there may be a small error).

    Imports System
    Imports Microsoft.SmallBasic.Library
    
    ''' <summary>
    ''' This class ...
    ''' </summary>
    <SmallBasicType()> _
    Public Module MyExtension
        ''' <summary>
        ''' My extension description
        ''' </summary>
        ''' <param name="Test">Test argument description</param>
         ''' <returns>The return is just the input parameter</returns>
        Public Function MyMethod(ByVal Test As Primitive) As Primitive
            Return Test
        End Function
    End Module
    • Edited by litdev Thursday, April 12, 2012 11:31 AM link corrected
    • Marked as answer by yoenmii Thursday, April 12, 2012 11:39 AM
    Wednesday, April 11, 2012 6:28 PM
  • It still doesn't appear in the intellisense, here is a .zip with the fragment of code : 

    Here is it :S

    It's very frustrating. T.T

    PS: Your link in the message before doesn't function (localhost/litdev) y haven't got the same computer as you.


    Nothing here



    • Edited by yoenmii Thursday, April 12, 2012 9:22 AM
    Thursday, April 12, 2012 9:19 AM
  • Sorry, the web link is http://litdev.hostoi.com/.  Will look at the code later (it has several subroutines of methods - I'm not going to debug them) so will consider the project settings and replace your case with something simple like above.  Try the simplest case (one method, one argument, one return and NOTHING else) possible first before coding lots of stuff.
    Thursday, April 12, 2012 10:05 AM
  • I tried with one method and one argument and I put the .dll in Small Basic installation directory.  When I open Small Basic it show an error:

    Microsoft Small Basic

    Microsoft Small Basic has detected a problem and It must close. (Nothing important: Sorry for the...)

    If in the process(I use Google translator with this word), the information can be lose.

    I'm not english and my Windows and Small Basic are in spanish; and I don't know how to translate good the message.


    Nothing here

    Thursday, April 12, 2012 10:29 AM
  • Good progress, so the dll is being found:

    [Q1] I assume you also have the intellisense (xml) also working?  Not critical, but if you have the dll the xml should also work.

    [Q2] I also assume the you have no problems with SmallBasic on its own or using orther extensions?

    So its probably down to the dll extension code or settings used to create it - I don't have access to VB till this evening when I will look at your code and at the very least create a simple project that works.

    If you make some progress in the meantime you can always upload the project you are working with, before I look at it.

    Thursday, April 12, 2012 10:38 AM
  • [Q1]I think yes.

    [Q2]I try speech extension an it works good :).

    ___________________________________________________________________

    Problem solved!!!

    I changed the target to .Net Framework 3.5 but I click in cancel in a window that appeared after click in accept in the settings window. (This is the error)

    And other error I search by the name of the project no the class name.

    (HUMAN ERRORS ONLY - My errors-. NO SOFTWARE ERRORS)

    Many thanks for the help. You are the Microsoft Moderator who has helped me the most :D. Hopefully all Microsoft Staff were like you :D.





    • Marked as answer by yoenmii Thursday, April 12, 2012 11:39 AM
    • Edited by yoenmii Thursday, April 12, 2012 11:43 AM Problem Solved
    Thursday, April 12, 2012 11:02 AM
  • well done
    Thursday, April 12, 2012 11:42 AM