Friday, 20 July 2012

get computer name,os name or user name in vb.net

In this Tutorial, I’m discourse cover how to obtain pieces of information about your computer or get os name, compter name etc . I will show you how to create a simple application that shows you different pieces of information about your computer. This can be very useful when you begin developing more advanced applications. Then you can add additional features for your application

Copy and paste below Code:

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox1.Text = My.Computer.Name
        TextBox2.Text = My.User.Name
        TextBox3.Text = My.Computer.Info.OSFullName
        TextBox4.Text = My.Computer.Keyboard.CapsLock
        TextBox5.Text = My.Computer.Mouse.WheelExists
        TextBox6.Text = My.Computer.Screen.WorkingArea.ToString
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TextBox1.Clear()
        TextBox2.Clear()
        TextBox3.Clear()
        TextBox4.Clear()
        TextBox5.Clear()
        TextBox6.Clear()
    End Sub

End Class