0% found this document useful (0 votes)
4 views234 pages

Visual Basic .Net Programming

Uploaded by

kdec.online
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views234 pages

Visual Basic .Net Programming

Uploaded by

kdec.online
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 234

wfRyq¨vj †ewmK.

†bU †cÖvMÖvwgs
9g cwi‡”Q`: Ready-made functions and methods
evbv‡bv dvskb I †g_W: Ready-made functions & Methods
Dim Word1 As String = "" : Dim Word2 As String = "p "
'comapre
If String.Compare(Word1, Word2, False) = 0 Then
MsgBox("String Match")
Else
MsgBox("String does not Match") 'this message appears
End If

4. Insert -GB dvsk‡bi KvR n‡jv w÷ªs Gi K¨viv±vi cwRk‡b cÖ`Ë w÷ªs XzKv‡bv| †hgb:
wf
' Insert the word [and].
Dim names As String = "Romeo Juliet"
Ryq BwÄ *---
Dim Shakespeare As String = names.Insert(6, "and ") ' 'and ' inserted in the space (character 'position
6: result: "Romeo and Juliet"
¨vj wbqvi ----

5. Length -GB dvsk‡bi KvR n‡jv w÷ªs Gi †fZi KÕwU K¨viv±vi Av‡Q Zv wbY©q Kiv: †hgb:
Dim value As String = "dotnet"
**

†e wRRyj ----
Dim length As Integer = value.Length 'gives length = 6
value += ".aziz" 'now value is 'dotnet.aziz'
wmK evi ---
length = value.Length 'gives length = 11
Av

6. Remove -GUv Øviv †Kv‡bv w÷ªs Gi cÖ`Ë cwRkb †_‡K evwK me¸‡jv gy‡Q †djv hvq| †hgb:
.†b wm‡jU --*
' Completely incorrect input string.
Dim value As String = "Engineer Azizul Bari wrote 'Visual Basic.Net Programming'. and.."
'We need to remove ' and..' part, eg. everything after last SPACE
x,

U † 2017 **
Dim index As Integer = value.LastIndexOf(" "c)
' Remove everything starting at that position.
cÖv |
value = value.Remove(index)
TextBox1.Text = value
MÖv
-

7. Replace -G dvsk‡bi KvR n‡jv †h †Kv‡bv w÷ªs - †hgb †Kv‡bv WKz‡g‡›Ui †U·‡U GKB kã ev jvBb
wgs
BZ¨vw` h‡ZveviB _vKzb bv †K‡bv, Zv GK m‡½ e`jv‡bv| †hgb:
Dim FstString As String = "Avgiv GB †jLvi ZvB kã e`jv‡Z PvB| ZvB, ZvB"
FstString = FstString.Replace("ZvB", "")
MsgBox(FstString) 'gives ÔAvgiv GB †jLvi kã e`jv‡Z PvB|Õ

8. Substring -GUv GKwU mPivPi e¨eüZ dvskb| Gi KvR n‡jv †h †Kv‡bv †jLv †_‡K cÖ`Ë Aÿimg~n
mwi‡q wb‡q cÖ`k©b Kiv| †hgb:
'Use this string literal for the demonstration.
Dim literal As String = "Our Our country is Bangladesh." -Avgiv ÔOurÕ kãwU †ei Ki‡ev|
Dim substring As String = literal.Substring(0, 4) 'first word
MsgBox(substring) 'will show - Our country is Bangladesh.

47
wfRyq¨vj †ewmK.†bU †cÖvMÖvwgs
9g cwi‡”Q`: Ready-made functions and methods
evbv‡bv dvskb I †g_W: Ready-made functions & Methods
9. Contains -GUv Øviv Rvbv hvq GKwU w÷s Gi g‡a¨ Av‡iKwU w÷ªs Av‡Q wK bv| djvdj True ev False|
†hgb:
Dim literal As String = "  p b   ।" : Dim newString As Boolean =
literal.Contains("p ")
MsgBox("p : " & newString) 'result True : Dim newStringt As Boolean = literal.Contains
("-. /") : MsgBox("-. /: " & newStringt) 'result False

10. InStr -GB dvskb w`‡q GKwU w÷ªs Gi †fZi Av‡iv GKwU w÷ªs Av‡Q wK bv cixÿv Kiv hvq| †hgb:
wf
Dim literal As String = "  p b   ।"
Dim isString As Integer = InStr(literal, "", CompareMethod.Text)
Ryq BwÄ *---
MsgBox(isString) 'returns 24 -found at character position 24
isString = InStr(literal, "- ", CompareMethod.Binary)
¨vj wbqvi ----
MsgBox(isString) 'retuns 0 -string not found

11. Mid -GwU w`‡q w÷ªs Gi †fZi †_‡K Kvw•ÿZ w÷ªs †ei Kiv hvq| †hgb:
**

†e wRRyj ----
Dim literal As String = "  p b   ।"
Dim NString As String = Mid(literal, 6, Len(literal))
wmK evi ---
Av

MsgBox(NString) 'result-  p b   ।

jÿ Kiæb: Length dvskb I Dc‡i e¨eüZ Len dvskb Gi KvR GKB| cÖ_gwU wfRyq¨vj †ewmK-‡K wfRyq¨vj
.†b wm‡jU --*

†ewmK.†bU -G DbœxZKiYKv‡j mshy³ Kiv n‡q‡Q| Z‡e DfqwUB Kvh©Kix|


x,

U † 2017 **
12. GKwUgvÎ K¨viv±vi evievi †jLv: wb‡Pi †KvWwU G KvR K‡i|
Dim txt As New String("."c, 5)
cÖv |

MsgBox(txt) -djvdj -.....


MÖv
-

13. ToUpper & ToLower -G dvskb Øviv `yÕ‡Uv ïaygvÎ Bs‡iwR Aÿimg~n eo Ges †QvU Kiv hvq| †hgb:
wgs
Dim word As String = "ViSuAL bASiC"
MsgBox(word.ToUpper) 'gives VISUAL BASIC
MsgBox(word.ToLower) 'gives visual basic
†bvU: evsjv BDwb‡KvW †jLv n‡j Dfq dvskb KvR K‡i bv| †jLv AcwiewZ©Z _vK‡e|

14. w÷ªs -Gi mKj Aÿi Avjv`v K‡i †ei Kiv: wb‡Pi †KvWUzKz G KvR Ki‡e| jÿYxq- †¯úBm ev
k~b¨¯’vb‡KI †KvW K¨viv±vi wnmv‡e mbv³ K‡i|
Dim AworD As String = "I am a programmer."
For i As Integer = 0 To AworD.Length - 1 'Or 0 to len(AworD) -1
MsgBox(AworD.Chars(i)) 'shows each character of the sentence
Next

48

You might also like