SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2010
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    vis studio -- how to test simple vb.net code

    Hi,

    I'm going thru an asp.net 4 book, and I'm at a part about classes and their properties and functions. But up to now, all the examples involve a web_site, with controls, code_behind files, CSS, etc.

    But, I get to places where I don't understand the examples, so I look out on the web for other resources. For example, I found the code below to demonstrate the "ToString" function.

    My problem is, I'm not sure know how to test a little piece of code like this. Can't I just open up an application or project or something, paste this in and run it?
    THanks,
    Jeff

    Module Module1

    Class Perl

    Dim _a As Integer
    Dim _b As Integer

    Public Sub New(ByVal a As Integer, ByVal b As Integer)
    _a = a
    _b = b
    End Sub

    Public Overrides Function ToString() As String
    Return String.Format("[{0}, {1}]", _a, _b)
    End Function

    End Class

    Sub Main()
    Dim p As Perl = New Perl(2, 3)
    Console.WriteLine(p)
    End Sub

    End Module

  2. #2
    SitePoint Guru Jason__C's Avatar
    Join Date
    Oct 2009
    Location
    Racoon City
    Posts
    660
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi. Yes, you can test this in an IDE called Visual Studio 2010. In it, you can debug applications and execute your project within the program itself.

    http://www.microsoft.com/express/Downloads/

    Good Luck.

  3. #3
    SitePoint Enthusiast
    Join Date
    Dec 2010
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, I have that, but I guess my problem is it's so big, I don't know what to do to just bring in that code and test it. For example, it first asks if I want open a new project, existing project, new website, existing web site.

    If I open a project, then my choices are asp.net web application, class library, asp.net MVC 2 Web Application, Silverlight Application, Silverlight Class Library, WCF Service Application, ASP.NET Dynamic Data entities Web Application or Enable Windows Azure Tools....NONE of these sound like what I want.

    On the other hand, if I open a Site, then my choices are asp.net web site, asp.net empty web site, asp.net dynamic data entities web site, asp.net dynamic data linq to sql web site, and wcf service...THESE don't sound right either.

    Could you guide me thru the steps I need to take in order to setup this test?

    Thks!,
    JEff


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •