Monday 12 March 2012

vb.net string indexof() ?



I this tutorial you can learn how to get a specified string indexof (string position) in main string to make this program steeps to be followed
Step1:
Open Microsoft visual studio 2010 or any older version also may differ commands
Step2:
Open file new project(ctrl+shift+n)àselect windows form applicationà rename as you wish
Step3:
Drag and drop two label, textbox, and one button
Label1.textàmain string
Label2.textàsub string
Buttonàget
Step4:
Copy and paste the following code
    Public Class Form1
   
    Private SubButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton1.Click
        Dim mianstring As String = TextBox1.Text
        Dim substring As String = TextBox2.Text
        MessageBox.Show(mianstring.IndexOf(TextBox2.Text))
    End Sub
End Class

Output:

No comments:

Post a Comment