һС¶Î¹Ø¼ü´Ê·ÖÎö´úÂë(VB)
°ïÅóÓѸĵÄһС¶Î¹Ø¼ü´Ê·ÖÎö´úÂ룻 º¬Á½¸öµ¥´Ê¸´ºÏ¼ÆÊý
Private Function CollectWords() As Dictionary(Of String, Integer)
'Create a new dictionary
Dim table As New Dictionary(Of String, Integer)
'Prompt for the user
Console.WriteLine(
"Enter a line : ")
'Get the user's input
Dim input As String = Console.ReadLine()
'Split the line and make an array of words
Dim words As String() = input.Split()
Dim wordPrev As String = ""
'Search the array
For Each word In words
'We can get the lowercase, not necessary here
Dim wordKey As String = word.ToLower()
'If the dictionay contains the words
If table.ContainsKey(wordKey) Then
'increment
table(wordKey) = table(wordKey) + 1
Else
'add a new word with a count of 1 in the dictionary
table.Add(wordKey, 1)
End If
Dim wordKey2 As String = (wordPrev + " " + word).ToLower()
If wordPrev <> "" Then
If table.ContainsKey(wordKey2) Then
'increment
table(wordKey2) = table(wordKey2) + 1
Else
'add a new word with a count of 1 in the dictionary
table.Add(wordKey2, 1)
End If
End If
wordPrev = word
Next
Return table
End Function
Ïà¹ØÎĵµ£º
·ÖÀࣺVBѧϰ ×ֺţº ´ó´ó ÖÐÖРСС mid(×Ö·û´®£¬´ÓµÚ¼¸¸ö¿ªÊ¼£¬³¤¶È) ÔÚ[×Ö·û´®]ÖÐ[´ÓµÚ¼¸¸ö¿ªÊ¼]È¡³ö[³¤¶È¸ö×Ö·û´®]
ÀýÈç mid("СÐÀÎÞµÐ",1,3) Ôò·µ»Ø "СÐÀÎÞ"
instr(´ÓµÚ¼¸¸ö¿ªÊ¼,×Ö·û´®1,×Ö·û´®2) ´Ó¹æ¶¨µÄλÖÿªÊ¼²éÕÒ£¬·µ»Ø×Ö·û´®2ÔÚ×Ö·û´®1Öе ......
VBÑÕÉ«ºÍRGBÉ«»¥Ïàת»»Í·ÌÛÁËÎÒºÃÒ»¶Îʱ¼ä,Èç½ñÕÒµ½½â¾ö°ì·¨ÁË
ÌرðÌù³öÀ´Óë´ó¼Ò¹²Ïí
Type RGB
Red As String
Green As String
Blue As String
End Type
Public Function ColorToRGB(ByVal dwColor As Long) As RGB
Dim clrHex ......
VBʵÏÖVC TabControl¿Ø¼þ
н¨Ò»¸ö¹¤³ÌÎļþProject1£¬
ÔÚ×ó²à¹¤¾ßÀ¸ÖеãÓÒ¼ü
ÔÚ³öÏÖµÄÑ¡ÏîÖеã“Components”£¬ÔÚ´ò¿ª´°¿ÚÖÐÕÒµ½“Controls”Ñ¡ÏîÒ²ÖеēMicrosoft Tabbed Dialog Control 6.0”£¬È»ºóµã“Ó¦ÓÔ“È·¶¨”Í˳ö¸Ãҳà ......
VBµÄ´úÂë´æ´¢ÔÚÄ£¿éÖС£ÔÚVBÖÐÌṩÁËÈýÖÖÀàÐ͵ÄÄ£¿é£º´°ÌåÄ£¿é¡¢±ê׼ģ¿éºÍÀàÄ£¿é¡£
¡¡¡¡¼òµ¥µÄÓ¦ÓóÌÐò¿ÉÒÔÖ»ÓÐÒ»¸ö´°Ì壬ËùÓõijÌÐò¶¼×¤ÁôÔÚ´°ÌåÄ£¿éÖУ¬¶øµ±Ó¦ÓóÌÐòÅÓ´ó¸´ÔÓʱ£¬¾ÍÒªÁíÍ⸽¼Ó´°Ìå¡£×îÖÕ¿ÉÄÜÓм¸¸ö´°ÌåÖÐÓÐһЩ¹²Í¬¶¼ÒªÖ´ÐеĴúÂ룬ΪÁËÔÚÁ½¸ö´°ÌåÖв»²úÉúÖظ´´úÂ룬¿É´´½¨Ò»¸ö¶ÀÁ¢µÄÄ£¿é£¬ÓÃËüʵÏÖ´ú ......
ÎÞÒâÖз¢ÏÖVB ForÑ»·µÄÒ»¸öÌص㣺ÔÚÑ»·ÌåÖУ¬Æóͼ¸Ä±äÑ»·ÖÕÖ¹±äÁ¿Ê¹Ö®ÌáÇ°Í˳öÑ»·ÊÇͽÀ͵ġ£
Private Sub Form_Load()
Dim s(0 To 4) As String
Dim N As Integer, i As Integer
s(0) = "²âÊÔ1"
s(1) = "²âÊÔ2"
s(2) = "²âÊÔ3"
s(3) = "²âÊÔ4"
s(4) = "²âÊÔ5 ......