Archive

Archive for the ‘VB.NET’ Category

Microsoft “Roslyn” CTP

July 20th, 2012 No comments

The Microsoft “Roslyn” June 2012 CTP installs as an extension to Visual Studio 2012 RC and Visual Studio 2010 SP1. “Roslyn” is a long lead project which we are considering for the post-Visual Studio 2012 timeframe. The CTP includes an early preview of the APIs exposed by the C# and Visual Basic compilers, and the C# Interactive window experience.

Download from here.

VN:F [1.9.18_1163]
Rating: 0.0/5 (0 votes cast)
Categories: C#, DOTNET, VB.NET

Pronunciation learning tool–using .NET

April 6th, 2012 No comments

This tool will help you to access to American and British pronunciation for the doubtful words without searching the internet.

I call this tool: TFD Pronounce

image

Download the application from here – from 4Shared

Download the application from here – from DropBox

Points to Note:

  • When you invoke the application, the input box will auto-fill any text in the clipboard
  • When you close the application, it will be minimized to system tray. Right click to exit the application
  • This application uses TheFreeDictionary.com to play the pronunciation.
  • Since it is a website and I use some crawling technique, this application will stop working any time when they change the website layout.
  • The application is programmed using .NET Framework 4.0 under Visual Studio 2010. You might want to install .NET framework 4.0 to execute this applicaion
  • If somebody needs source-code, please put a comment in this blog

Please provide your valuable comments.

If you are an English pronunciation learner, I recommend you to visit my past post on mis-pronounced words here.

VN:F [1.9.18_1163]
Rating: 5.0/5 (3 votes cast)
Categories: General, VB.NET

Connect using UDL file from .NET

July 7th, 2010 No comments

Here is a sample code:

Imports System.Data.OleDb
 
Public Class Form1
 
    Private Sub Button1_Click(ByVal sender As System.Object, 
		ByVal e As System.EventArgs) Handles Button1.Click
        If (OpenFileDialog1.ShowDialog() <> 
		Windows.Forms.DialogResult.OK) 
		Then Return
        Button1.Enabled = False
        Dim udlfile As String = OpenFileDialog1.FileName
        Label2.Text = "UDL File: " & udlfile
        Dim myConnection As OleDbConnection 
		= New OleDbConnection("File Name = " & udlfile)
 
        Try
 
            myConnection.Open()
            If (myConnection.State = ConnectionState.Open) Then
                TextBox1.Text = "Connection opened successfully!"
            Else
                TextBox1.Text = "Connection could not be established"
            End If
        Catch ex As Exception
 
            TextBox1.Text = ex.Message.ToString()
 
        Finally
 
            myConnection.Close()
        End Try
 
        Button1.Enabled = True
    End Sub
 
End Class
VN:F [1.9.18_1163]
Rating: 4.0/5 (1 vote cast)
Categories: DOTNET, VB.NET

Manipulate TFS from VB.NET – a starter

February 9th, 2010 No comments

Here is a quick script which demonstrates how to connect to TFS and get projects. Make sure you add reference to necessary dlls – Microsoft.TeamFoundation.Client and Microsoft.TeamFoundation.WorkItemTracking.Client

Imports Microsoft.TeamFoundation.Client
Imports Microsoft.TeamFoundation.WorkItemTracking.Client
Imports System.Net
 
Public Class Form1
    Dim nc As NetworkCredential = New NetworkCredential("user", "pass")
    Dim tfsurl As New Uri("http://192.168.0.2:8080")
    Dim tfs As TeamFoundationServer
    Dim wis As WorkItemStore
 
    Private Sub Form1_Load(ByVal sender As System.Object, 
	ByVal e As System.EventArgs) Handles MyBase.Load
        tfs = New TeamFoundationServer(tfsurl.AbsoluteUri, nc)
    End Sub
 
    Private Sub Button1_Click(ByVal sender As System.Object, 
	ByVal e As System.EventArgs) Handles Button1.Click
        tfs.Authenticate()
 
        wis = tfs.GetService(GetType(WorkItemStore))
        For Each proj As Project In wis.Projects
            If (proj.HasWorkItemReadRights) Then
                ListBox1.Items.Add(proj.Name)
            End If
        Next
    End Sub
End Class
VN:F [1.9.18_1163]
Rating: 5.0/5 (3 votes cast)
Categories: Code Snippets, DOTNET, VB.NET

Simple WPF ViewModel implementaion with VisualBasic.NET

February 2nd, 2010 No comments

This is my trial for applying View-ViewModel concept in WPF Windows application. I do not have a Model for this sample so omitting that word ;)

This is the XAML code which I used. Here I tried to do text binding with a TextBox and Command binding with a Button.

File 1: Window1.xaml

<Window x:Class="Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:System="clr-namespace:System;assembly=System.Core"
    Title="Window1" Height="300" Width="300" Name="Window1">
    <Grid>
        <Button Margin="121,129,82,110" Name="Button1" 
		Command="{Binding ClickCommand}">Button</Button>
        <TextBox Height="23" Margin="76,0,82,63" Name="TextBox1" 
		VerticalAlignment="Bottom" Text="{Binding mytext}" />
    </Grid>
</Window>

 

File 2: Window1.xaml.vb

Class Window1
    Private Sub Window1_Loaded(ByVal sender As System.Object, 
	ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
        Dim vm As New ViewModel
        vm.mytext = "test"
        Window1.DataContext = vm
    End Sub
End Class

And here is the VB.NET code:

File 3: ViewModel.vb

Imports System.ComponentModel
 
Public Class ViewModel
    Implements INotifyPropertyChanged
    Public _mytext As String
    Public Property mytext() As String
        Get
            Return _mytext
        End Get
        Set(ByVal value As String)
            _mytext = value
        End Set
    End Property
 
    Public Property ClickCommand() As ICommand
        Get
            Return New ClickCommando(Me)
        End Get
        Set(ByVal value As ICommand)
 
        End Set
    End Property
 
    Public Event PropertyChanged As PropertyChangedEventHandler 
	Implements INotifyPropertyChanged.PropertyChanged
 
End Class
 
Public Class ClickCommando
    Implements ICommand
 
    Private _vm As ViewModel
 
    Public Sub Execute(ByVal parameter As Object) Implements ICommand.Execute
        MessageBox.Show(_vm.mytext)
    End Sub
 
    Public Function CanExecute(ByVal parameter As Object) As Boolean 
	Implements ICommand.CanExecute
        Return True
    End Function
 
    Public Event CanExecuteChanged As EventHandler 
	Implements ICommand.CanExecuteChanged
 
    Public Sub New(ByVal vm As ViewModel)
        _vm = vm
    End Sub
 
End Class
VN:F [1.9.18_1163]
Rating: 3.0/5 (2 votes cast)

C# typeof equivalent in Visual Basic

January 27th, 2010 No comments

Visual Basic.NET equivalent of C#’s typeof is GetType and NOT TypeOf

VN:F [1.9.18_1163]
Rating: 5.0/5 (1 vote cast)
Categories: C#, VB.NET

Article: One…Two…Three… Start! LINQ! – A quick start guide

August 14th, 2008 No comments

Read my article about LINQ at Kidoos.net

URL: http://kidoos.net/content/StartLINQ.aspx

VN:F [1.9.18_1163]
Rating: 0.0/5 (0 votes cast)
Categories: C#, DOTNET, VB.NET

DataSets vs. Collections

April 18th, 2008 No comments

There is a good article on DataSets vs. Collections by Dino Esposito

If you read this article, you will start using (Generics) Collections instead of DataSet/DataTable for database access. :)

Here is the URL: http://msdn2.microsoft.com/en-us/magazine/cc163751.aspx

VN:F [1.9.18_1163]
Rating: 0.0/5 (0 votes cast)
Categories: C#, DOTNET, VB.NET

C# & Visual Basic Language Specification

April 7th, 2008 No comments

C# 3.0 Language Specification Word Document can be downloaded at http://download.microsoft.com/download/9/5/0/9503e33e-fde6-4aed-b5d0-ffe749822f1b/csharp%203.0%20specification.doc

Same way, you can download Visual Basic 9.0 Language Specification at http://go.microsoft.com/fwlink/?LinkID=102846

VN:F [1.9.18_1163]
Rating: 0.0/5 (0 votes cast)
Categories: C#, VB.NET

System.Net.Mail exclusive

March 18th, 2008 No comments

I just gone through an interesting website which is exclusively for System.Net.Mail!

http://www.systemnetmail.com/

Also, there is another website from them – http://www.systemwebmail.com/ which is for System.Web.Mail (.NET Framework 1.1)

VN:F [1.9.18_1163]
Rating: 0.0/5 (0 votes cast)
Categories: C#, VB.NET