How to string char() in vb.net?
I this tutorial you can learn how to get char from string declared (get char)
Syntax:
String.char(string str,char str2)
Here : Stràfisrt string
Str2àget char
Charàchar data type
String à string data type
Ex: str = string.char(3)
The char at 3 position will get into str
To do this program following steps 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à1st string
Label2.textà2nd string
Buttonàcheck
Step4:
Copy and paste the following code
Public Class Form1
Private Sub Button1_Click(ByValsender As System.Object, ByVal e AsSystem.EventArgs) HandlesButton1.Click
Dimststring As String= TextBox1.Text
Dim getchar As Char
getchar = ststring.Chars(TextBox2.Text)
MessageBox.Show(getchar)
End Sub
End Class
Output:
No comments:
Post a Comment