Login(Email) Password Forget Password? Account Settings
Home ASP.net System Info C# Books Java Script Visual C++(MFC) C/C++ Win API Java Contact Us
How to use Clipboard Access in vb.net  visual Studio.net
To use clipboard option in vb.net you can use Clipboard object.
Dim txtdata As IDataObject = Clipboard.GetDataObject()

' Check to see if the Clipboard holds text
If (txtdata.GetDataPresent(DataFormats.Text)) Then
    TextBox1.Text = txtdata.GetData(DataFormats.Text).ToString()

End If
 

To export or save the contents of a TextBox to the Clipboard, use this code:

Clipboard.SetDataObject(TextBox1.Text)
How to use Array of Objects in Vb.net

All data in .NET are technically objects. Also, you can create an array of objects (in this way you can store different data types within the same array). To create an object array, you first declare an object variable, then instantiate each object in the array.

Dim arrBook(6) As Book 'create the array object variable
Dim i As Integer

        'instantiate each member of the array:
        For i = 0 To 6
            arrBook(i) = New Book()
        Next

        ' set the two properties of one of the array members
        arrBook(3).Title = "Babu"
        arrBook(3).Description = "This book is large."

        Dim s As String = arrBook(3).Title
        Console.WriteLine(s)

How to use HashTable in Vb.net
The collection class called a HashTable is quite similar to the ArrayList in both design and features. However, a HashTable permits "strong data typing": You can give each element a name in addition to its index number.In some situations, it's easier to work with a collection if each element is labeled. Say your collection holds the foods eaten by each animal in your private zoo. It's simpler to manage the data if each element is named after a different animal
Dim Food As New Hashtable()
     Food.Add("Lion", "Meat")
     Food.Add("Bear", "Meat")
     Food.Add("Penguin", "Fish")
     Console.WriteLine(Food.Item("Bear"))
In this example, the names of the animals can be used as keys to access the elements,
instead of index numbers. Each key must be unique, though the data itself can
be duplicated (''meat" and "meat" in this example).
How to Detecting Key Presses in vb.net visual Studio.net

The following example show how to use the KeyChar property to figure out which key the user pressed. You compare it to the Keys enumeration (a list of built-in constants that can be used to identify keypresses). The following code checks to see if the user presses the Enter key:

Private Sub TextBox1_KeyPress(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        If Asc(e.KeyChar) = Keys.Enter Then
            MsgBox("ENTER")
        End If
    End Sub

The following example shows how to detect if the user presses Ctrl+N on the form
(to set the Form's KeyPreview property to True):

Private Sub Form1_KeyDown(ByVal sender As Object, _
 ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.N And e.Control = True Then 
'they pressed CTRL+N
searchnext() 'respond to this key combination
Exit Sub
End If
End Sub
Loading Graphics with LoadPicture in vb.net

Now in VB.NET, you can loadimage  with following code
PictureBox1.Image = Image.FromFile("C:\Graphics\MyDog.jpg")

How to sendKeys to Application using Shell Commnd

You can still use the Shell command to run an application, such as Notepad. Shell works much as it did in VB6. An associated command, SendKeys, imitates the user typing on the keyboard. SendKeys works differently in VB.NET. This code will run an instance of Windows's Notepad, and then "type" This message into Notepad:

Dim X As Object
X = Shell("notepad.exe" , AppWinStyle.NormalFocus)
System.Windows.Forms.SendKeys.Send("This Message")

WARNING If you put this code in a Form_Load event, it will only send the T into otepad (there are timing problems involved). So, put it into a different event, such as Button1_Click, and VB.NET will have enough time to get itself together and send the full message.