用VB怎么定义一个函数?

用VB怎么定义一个函数


慕村9548890
浏览 4229回答 2
2回答

慕森王

Dim t As Long_________________________________________Public Function j(n As Integer) As Longt = 1For i = 1 To nt = t * iNext ij = tEnd Function_______________________________________Private Sub Command1_Click()Text1.Text = j(8) '这里就可以调用函数了End Sub

森林海

Private Function f(Dim n As Integer) as Integerif n=0 thenf=1elsefor i=1 to nt=t*inextf=tendifEnd Function调用的时候如下,x等于24x=f(4)
打开App,查看更多内容
随时随地看视频慕课网APP