大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
是关键字。比如:SUB代表一个函数的开始,END SUB代表函数结束,函数主体语句就必须写在这两个关键字之间。CLASS类关键字,PRIVATE私有关键字,PUBLIC公用关键字,IF.....END IF是判断关键字,等等。建议找本基础书看一看。
冠县网站建设公司创新互联,冠县网站设计制作,有大型网站制作公司丰富经验。已为冠县千余家提供企业网站建设服务。企业网站搭建\外贸网站制作要多少钱,请找那个售后服务好的冠县做网站的公司定做!
Private Sub RichTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged
Dim pos = RichTextBox1.SelectionStart
Dim i As String = Regex.Matches(RichTextBox1.Text, "\bDim\b").ToString
RichTextBox1.SelectAll
RichTextBox1.SelectionColor = Color.Black
If Regex.IsMatch(RichTextBox1.Text, "\bDim\b") = True Then
For Each mat As Match In Regex.Matches(RichTextBox1.Text, "\bDim\b")
RichTextBox1.SelectionStart = mat.Index
RichTextBox1.SelectionLength = mat.Length
RichTextBox1.SelectionColor = Color.YellowGreen
Next
End If
RichTextBox1.SelectionStart = pos
RichTextBox1.SelectionLength = 0
End Sub
我做了一个更详细的正则:
Friend Keys As String =
"\b(#Const|#If|Then|#Else|#Region|Delegate|Namespace|Class|End|Firend|Partial|Module|Interface|Enum|Shared|Overrides|Overloads|Structure|Let|Const|Dim|As|Private|Public|New|Static|Option|Private|Module|IsArray|IsDate|IsEmpty|IsError|IsMissing|IsNull|IsNumeric|IsObject|TypeName|VarType|Me|Option|Explicit|Mod|Like|Is|Not|And|Or|Xor|Eqv|Imp|Clear|Error|Raise|Error|Err|CVErr|On|Error|Resume|IsError|Collection|Add|Remove|Item|DDB|SLN|SYD|FV|Rate|IRR|MIRR|NPer|IPmt|Pmt|PPmt|NPV|PV|Do|Loop|For|Next|For|Each|Next|While|Wend|With|Choose|If|Then|Else|Select|Case|Switch|Call|Function|Property|Get|Property|Let|Property|Set|Sub|Date|Now|Time|DateAdd|DateDiff|DatePart|DateSerial|DateValue|TimeSerial|TimeValue|Date|Time|Timer|CBool|CByte|CCur|CDate|CDbl|CDec|CInt|CLng|CSng|CStr|CVar|CVErr|Fix|Int|Boolean|Byte|Currency|Date|Double|Integer|Long|Object|Single|String|Object|Atn|Cos|Sin|Tan|Exp|Log|Sqr|Randomize|Rnd|Abs|Sgn|Fix|Int|IsArray|Array|Option|Base|Dim|Private|Public|ReDim|Static|LBound|UBound|Erase|ReDim|DeleteSetting|GetSetting|GetAllSettings|SaveSetting|Chr|Format|LCase|UCase|DateSerial|DateValue|Hex|Oct|Format|Str|CBool|CByte|CCur|CDate|CDbl|CDec|CInt|CLng|CSng|CStr|CVar|CVErr|Fix|Int|Day|Month|Weekday|Year|Hour|Minute|Second|Asc|Val|TimeSerial|TimeValue|StrComp|StrConv|Format|LCase|UCase|Space|String|Len|Format|LSet|RSet|InStr|Left|LTrim|Mid|Right|RTrim|Trim|Option|Compare|Asc|Chr|AppActivate|Shell|SendKeys|Beep|Command)\b"
窗体上添加一个文本框,一个列表框,一个按钮:
代码如下:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyDir As String = "C:\123"
Dim MyFilter As String = "*" TextBox1.Text "*"
ListBox1.Items.Clear()
For Each MyFile As String In System.IO.Directory.GetFiles(MyDir, MyFilter)
ListBox1.Items.Add(MyFile)
Next
End Sub
有的,功能:
将为显示而格式化的数据写入顺序文件。
你使用下面这段例子,看看结果:
FileOpen(1, "c:\实验.txt", OpenMode.Output) ' Open file for output.
Print(1, "This is a test.") ' Print text to file.
PrintLine(1) ' Print blank line to file.
PrintLine(1, "Zone 1", TAB(), "Zone 2") ' Print in two print zones.
PrintLine(1, "Hello", "World") ' Separate strings with a tab.
PrintLine(1, SPC(5), "5 leading spaces ") ' Print five leading spaces.
PrintLine(1, TAB(10), "Hello") ' Print word at column 10.
顾名思义,new就是给变量赋值一个新的对象
dim不加new就是说变量是XX类型的,但它不是一个真正的XX对象。如果给这个变量赋值的话,实际上就是把某一对象的指针存到变量里,它依旧不是一个对象
一个普通的类,里面有一些数据,你要弄一个对象的话,需要初始化所有类中的数据并调用构造函数。这时候我们就用new了。如果你不用new,然后直接使用的话,会引发null异常
当然上面的讨论不包括Integer、String、Long这样的数值类型,这些不能用new