Categories

Thousands of experts bid on your personal project at ScriptLance.com

get ip address

get ip address with VB.net

Module Module1

Sub Main() Dim h As System.Net.IPHostEntry = System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName) Console.WriteLine(CType(h.AddressList.GetValue(0), Net.IPAddress).ToString) End Sub

End Module

Bookmark It

Hide Sites

$$(‘div.d94′).each( function(e) { e.visualEffect(’slide_up’,{duration:0.5}) });

FileStream example

opening and reading a file using the FileStream with VB.net

Imports System.IO

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim objStream As New IO.FileStream("d:\BOOT.txt", IO.FileMode.Open) Dim objReader As New IO.StreamReader(objStream) Dim strBuffer As String

strBuffer = objReader.ReadToEnd

objReader.Close() objStream.Close()

MsgBox(strBuffer) End Sub End Class

Bookmark It

Hide Sites

$$(‘div.d93′).each( function(e) { e.visualEffect(’slide_up’,{duration:0.5}) });

use a process to open a fie in notepad

This example shows us how to to open a fie in notepad using C#

Imports System.Windows.Forms ‘add a reference to this Project/Add Reference

Module Module1

Sub Main() Try ‘change the file to be opened System.Diagnostics.Process.Start("notepad.exe", "C:\testfile.txt") Catch MessageBox.Show("Error cannot load notepad") End Try

End Sub

End Module

Bookmark It

Hide Sites

$$(‘div.d72′).each( function(e) { e.visualEffect(’slide_up’,{duration:0.5}) });

list serial ports

This VB.net example shows how to list all serial ports

Module Module1

Sub Main() For Each portName As String In My.Computer.Ports.SerialPortNames Console.WriteLine(portName) Next

Console.ReadLine() ‘wait for user input End Sub

End Module

Bookmark It

Hide Sites

$$(‘div.d71′).each( function(e) { e.visualEffect(’slide_up’,{duration:0.5}) });

random numbers

This example shows how to produce random numbers in VB.net

Imports System.IO

Module Module1

Sub Main() Dim generator As New Random Dim randomValue As Integer Dim count As Integer

For count = 1 To 10 randomValue = generator.Next(1, 100) Console.WriteLine(randomValue) Next Console.ReadLine() ‘wait for user input End Sub

End Module

Bookmark It

Hide Sites

$$(‘div.d70′).each( function(e) { e.visualEffect(’slide_up’,{duration:0.5}) });