Tag Archives: DotNet

Check out the new VB.NET and .NET Framework version 4.0!

Click Star to Rate Post
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
 

This post is now Obsolete

Microsoft has had available for alittle while now a beta of their Visual Studio suite which I think is being called: Visual Studio 2010. Below is a simple overview of DotNET 4.0 Beta…

Get low cost Computer and Electronics Here!

Everything you want for your computer and more at Newegg.com.


Overview

The Microsoft .NET Framework 4 provides the following new features and improvements:

  • The .NET Framework 4 works side by side with the Framework version 3.5 SP1. Applications that are based on earlier versions of the Framework will continue to run on that version. Just a subset of functionality is shared by all versions of the Framework.
  • Innovations in the Visual Basic and C# languages, for example statement lambdas, implicit line continuations, dynamic dispatch, and named/optional parameters.
  • The ADO.NET Entity Framework, which simplifies how developers program against relational databases by raising the level of abstraction, has many new features. These includes persistence ignorance and POCO support, lazy loading, test-driven development support, functions in model, and new LINQ operators.
  • Enhancements to ASP.NET:
    • New JavaScript UI Templates and databinding capabilities for AJAX.
    • New ASP.NET chart control.
  • Improvements in WPF:
    • Added support in Windows Presentation Foundation (WPF) for Windows 7 multi-touch, ribbon controls, and taskbar extensibility features.
    • Added support in WPF for Surface 2.0 SDK.
    • New line-of-business controls including charting control, smart edit, data grid, and others that improve the experience for developers who build data centric applications.
    • Improvements in performance and scalability.
    • Visual improvements in text clarity, layout pixel snapping, localization, and interoperability.
  • Improvements to Windows Workflow (WF) that let developers to better host and interact with workflows. These include an improved activity programming model, an improved designer experience, a new flowchart modeling style, an expanded activity palette, workflow-rules integration, and new message correlation features. The .NET Framework also offers significant performance gains for WF-based workflows.
  • Improvements to Windows Communication Foundation (WCF) such as support for WCF Workflow Services enabling workflow programs with messaging activities, correlation support, durable two-way communication and rich hosting capabilities. Additionally, .NET Framework 4 provides new WCF features such as service discovery, router service, simplified configuration and a number of improvements to queuing, REST support, diagnostics, and performance.
  • Innovative new parallel programming features such as parallel loop support, Task Parallel Library (TPL), Parallel LINQ (PLINQ), and coordination data structures which let developers harness the power of multi-core processors.

Click Here for the Framework 4.0 Beta1 ONLY Download Page… – Check further down if you want both the Framework and Visual Studio.NET 2010 Beta1.

 Note: It should be noted that the 4.0 download size can be anywhere from 76.7MB to 380.5MB, depending on what’s the computers already has installed. .NET 4.0 will be similar to 3.5 in that it will contain full 2.0 and 3.0, and 3.5 support via a single download.


 Visual Studio .NET 2010 Beta1

  If your more interested in Visual Studio then check out Microsoft’s overview and click on the download links below..

Brief Description

Microsoft Visual Studio 2010 and the .NET Framework 4 are the next generation of Microsoft development tools. They work together to accelerate the process of turning vision into reality for the developer. Visual Studio 2010 Professional has been engineered to support the development of applications for Windows, the Web, and Office.

Overview

Visual Studio 2010 and the .NET Framework 4 mark the next generation of developer tools from Microsoft. Designed to satisfy the latest requirements of developers, Visual Studio delivers key innovations in the following areas:

Enabling emerging trends

Every year the industry develops new technologies and new trends. With Visual Studio 2010, Microsoft delivers tooling and framework support for the latest innovations in application architecture, development, and deployment.

Inspiring developer delight

Ever since the first release of Visual Studio, Microsoft has set the bar for developer productivity and flexibility. Visual Studio 2010 continues the tradition by significantly improving the experience for all software development roles.

Riding the next generation platform wave

Microsoft continues to invest in the market-leading operating system, productivity applications, and server platforms to deliver increasing customer value. With Visual Studio 2010, customers will have the tooling support that is required to create amazing solutions around these technologies.

For more information about Visual Studio 2010 and the .NET Framework 4, visit the Microsoft Visual Studio 2010 Web site.

Note: Microsoft has setup a couple different ways to download. The first is download via a ‘Web Install’ and the other is a ISO feature via a 2 Part download.

Click Here to goto the Download Page for Web Install…

Click Here to goto the Download Page for the ISO based downloads…


Remember that all of these downloads are considered Beta1 and therefore you should not make use in production based programming. Youcan, and probably will run into some problems, quirks, and even outright errors. If so, it would be helpful to send the info to Microsoft.

Have Fun!

Jason

Revised: 2015

How to use Visual Basic.NET Source Code and Features in VB 6.0

Click Star to Rate Post
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 4.00 out of 5)
 

There is no doubt the .NET Framework contains some rich and very useful objects to make many task very easy to do. Unfortunately Visual Basic 6.0 does not have direct access to these great features. BUT, all is not lost. You can create a COM Wrapper in Visual Basic.NET (I used VB 2005) to make features of the DotNETFramework available to the Legacy/Classic versions of Visual Basic. You can also use VB 2008 and Visual Basic 2010 (Express Edition should be just fine) if thats what you have.

Note: The example projects for this article has been done for a very long time and I forgot about putting a download link on this article. So here are the download links!

VB 6.0 Project with Compiled .NET Wrapper

VB 2005 Project with Compiled .NET Wrapper


Getting Started…

The first thing you would want to do is open up your Visual Basic.NET (Any version is fine as far as I know?.? I am using VB 05 in this article.) IDE and start a new Class Library project. Also, the actual Ping codes are NOT available in Visual Basic.NET 02/03. The principals in the article are the same but the actual Ping code will not work in the earlier dotnet languages. Now, Go ahead and just delete the original Class1.vb file since it is of no use for Fusion. Next goto the Project Menu and click on – Add New Item (Or you can click on ‘Add Class’ for VB 05/08) and select the ComClass Module. I named mine ‘pingWrapperForVB’. I went ahead and added a Reference to System.Windows.Forms since I wanted to use the more advanced MessageBox.Show feature instead of the legacy Msgbox. I also Imported the Namespaces below this image.

Adding the ComClass view


Add these Import Statements right above your Class.

Imports System.Net.NetworkInformation

Imports System.Windows.Forms

Important Note: When adding a COM Class it should automatically check the ‘Register for COM Interop‘ box. If it didn’t then you should go to the ‘Project’ menu and click on the ‘Project Properties‘ item. Click on the Compile option and scroll to the bottom of the page. You should see the ‘Register for Interop‘ checkbox. Make sure that checkbox is checked.

Important Note #2: Just remember if your program is going to be used on a computer other than the Developer computer, then you will need to register the .NET Managed wrapper as a COM object in the Windows registry. Click this link for more information.

Then I created a Public Function named: ping_AddressReply with Two (2x) parameters named (URL as String and TimeoutInMS as Integer) and it returns a Boolean type. I made the TimeoutInMS Parameter a Optional value with a default of 10 Seconds. This Function will be used to send a ping request and get the return value of the request, either ‘True’ that the Ping was successful or ‘False’ if it was not successful.

I then added just a basic Try/Catch/End Try feature that will throw a Ping Exception in a Messagebox if something didn’t go quite right. You can do your own error handling though. Within the Try/Catch structure I added the small piece of code below…

        'Simply sends a Ping request using the URL Parameter and the Timeout Parameter. I made the
        'timeoutInMS Parameter optional with a default value of 10 seconds.
        Return My.Computer.Network.Ping(url, timeoutInMS)

Setup the next Function the same as the first. Except making the Function type a Integer. Remember that VB 6.0 will see the .NET Integer as a Long. I named the Function ‘New ping_AddressTimeItTakes‘ as Integer. Then simple add the codes below inside the Try/Catch structure…

        Dim p As New Ping

        Dim reply As PingReplyreply = p.Send(url, timeoutInMS)

        Return CInt(reply.RoundtripTime)

You are now done with the wrapper. Look over your codes one last time to make sure they are correct and then compile the class library. You are now ready to use the wrapper in Visual Basic 5.0/6.0. Now load your VB 5.0/6.0 IDE and create a new .EXE Project type. I named mine: ‘PingAddressWrapperEx‘. I likewise I added 2x Labels named ‘lblReply’ and ‘lblTime’, a Textbox for the url I named: ‘txtAddress’, and 2x command buttons.  Name the buttons whatever you want to. Now goto the ‘Project’ menu and click on the ‘References’ menu item. Click on the Browse button and locate your .NET Project and goto the ‘Bin’ Directory (or where the compiled class is). Add a reference to the ‘TLB’ file and NOT the .DLL file. VB 6 cannot use the .DLL class directly and thus you need to reference the TLB file to get access to the .DLL in VB 5.0 and VB 6.

A reference view in VB 6.0

Once you create a reference to the TLB file, then add the line of code below in the declaration section…

        'I’m using ping to refer to the Wrapper.
        Dim ping As pingWrapperForVB6.pingWrapperForVB6

Once you take care of that, put the codes below in your command buttons…

    Private Sub cmdPing_Click()

        'Check if a instance of the class already exists, and if it isn’t then create a new instance of the ping wrapper.
        If ping Is Nothing Then

            'Create a new instance of the wrapper.
            ping = New pingWrapperForVB6.pingWrapperForVB6

        End If

        'Send the ping request and get the True or False messages.
        lblReply.Caption = "Replied: " & ping.ping_AddressReply(txtAddress.Text)

    End Sub

Likewise, put the codes below in the other command button…

    Private Sub cmdSendTime_Click()

        'Check if a instance of the class already exists, and if it isn't  then create a new instance of
        'the ping wrapper.
        If Ping Is Nothing Then

            'Create a new instance of the wrapper.
            Ping = New pingWrapperForVB6.pingWrapperForVB6

        End If

        'Send the ping request and display the time it takes to get a reply.
        lblTime.Caption = "Round Trip Time: " & Ping.ping_AddressTimeItTakes(txtAddress.Text, 10000) & "ms"

    End Sub

You can now run your project and put in the URL you want to ping. I put in: vbcodesource.com but you can put the url you want. But Do Not include the http:// portion of the url, it will cause the ping to fail. Now just click on the command buttons that has the code and you should see the status of the pings in the label controls…

Image of the final product :)


Hopefully you had no errors popping up. My example returned True that the url was available and a round trip time of: 42ms.  Thats all there is to it! You now have basic Ping capabilites in VB 6.0. Remember though, the target computer MUST have the version of the DotNET Framework you made the wrapper with. IF not then the Ping Wrapper will fail and you won’t have no ping capabilities. I will eventually add the actual projects for the .NET Wrapper and the VB 6 example when I get the time on my other site at: http://www.vbcodesource.com Anyways, have fun 🙂

               Jason