vb编程:单词分解怎么编?Private Sub Command1_Click() Dim s As String,a() As String,i As Integer s = Text1.Text Call aword(s,a) List1.AddItem p End Sub Private Sub Command2_Click() Text1.Text = "" List1.Clear Text1.SetFocus End Sub Private Sub

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/08 08:41:42

vb编程:单词分解怎么编?Private Sub Command1_Click() Dim s As String,a() As String,i As Integer s = Text1.Text Call aword(s,a) List1.AddItem p End Sub Private Sub Command2_Click() Text1.Text = "" List1.Clear Text1.SetFocus End Sub Private Sub
vb编程:单词分解怎么编?
Private Sub Command1_Click()
Dim s As String,a() As String,i As Integer
s = Text1.Text
Call aword(s,a)
List1.AddItem p
End Sub
Private Sub Command2_Click()
Text1.Text = ""
List1.Clear
Text1.SetFocus
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub aword(s As String,word() As String)
Dim ch As String * 1,p As String,k As Integer
For i = 1 To Len(s) - 1
ch = Mid(s,i,1)
If Asc(ch) 32 And ch "." Then
p = p & ch
Else
k = k + 1
ReDim Preserve word(k)
word(k) = p
p = ""
End If
Next i
End Sub
主过程应该怎么调用?

vb编程:单词分解怎么编?Private Sub Command1_Click() Dim s As String,a() As String,i As Integer s = Text1.Text Call aword(s,a) List1.AddItem p End Sub Private Sub Command2_Click() Text1.Text = "" List1.Clear Text1.SetFocus End Sub Private Sub
该程序不对啊,List1.AddItem p :这时的变量p已经为空了.
需要有三个按钮、一个文本框、一个listbox
我改后可以正常分解单词:
Private Sub Command1_Click()
Dim s As String,a() As String,i As Integer
s = Text1.Text
Call aword(s,a)
End Sub
Private Sub Command2_Click()
Text1.Text = ""
List1.Clear
Text1.SetFocus
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub aword(s As String,word() As String)
Dim ch As String * 1,p As String,k As Integer
Dim n As Integer,i As Integer
For i = 1 To Len(s)
ch = Mid(s,i,1)
n = Asc(ch)
If (n > 96 And n < 123) Or (n > 64 And n < 89) Or (n > 47 And n < 58) Or ch = "-" Or ch = "'" Then
p = p & ch
ElseIf p "" Then
k = k + 1
ReDim Preserve word(k)
word(k) = p
List1.AddItem p
p = ""
End If
Next i
If p "" Then List1.AddItem p
End Sub
--------------------
你这里很多变量都是局部变量,可以省去.省去后代码如下:
Private Sub Command1_Click()
Dim s As String
s = Text1.Text
Call aword(s)
End Sub
Private Sub Command2_Click()
Text1.Text = ""
List1.Clear
Text1.SetFocus
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub aword(s As String)
Dim ch As String * 1,p As String
Dim n As Integer,i As Integer
For i = 1 To Len(s)
ch = Mid(s,i,1)
n = Asc(ch)
If (n > 96 And n < 123) Or (n > 64 And n < 89) Or (n > 47 And n < 58) Or ch = "-" Or ch = "'" Then
p = p & ch
ElseIf p "" Then
List1.AddItem p
p = ""
End If
Next i
If p "" Then List1.AddItem p
End Sub

vb编程:单词分解怎么编?Private Sub Command1_Click() Dim s As String,a() As String,i As Integer s = Text1.Text Call aword(s,a) List1.AddItem p End Sub Private Sub Command2_Click() Text1.Text = List1.Clear Text1.SetFocus End Sub Private Sub 数控加工中心编程怎么编 vb 一个分段函数 编程错误 我用的 vb6.0版的 编一个分段函数 如下Private Sub form_Click()Dim x As Integer,y As Integerx = Val(InputBox(请输入x值:))If x 广州数控编程 G71 循环怎么编 编程1000以内能整除37数平方的和求代码大谢用VB编 VB里的sub单词是什么意思,比如private sub……、end sub VB题目:输入三角形的三边编程求出面积下面是我自己编的,可是好像是错的,大虾帮忙看看(我用了余弦定理)Private Sub Command1_Click()Dim x As Doublea = InputBox(请输入三角形第一边)b = InputBox(请输入 VB编程问题.如何让计算出的100以内的勾股数的计算结果显示在List中?现在编的程序如下:Private Sub Command1_Click()Dim a,b,c As DoubleFor a = 1 To 100For b = a To 100c = Sqr(a * a + b * b)If c = Fix(c) And c vb(编程)定义变量为实数,怎么表示? 广州数控车床外圆倒角编程怎么算怎么编 VB随机产生一个英文字母程序怎么编啊? 大学VB整除运算按要求与步骤的怎么编程?重点编程程序代码! VB编程:编递归函数过程,计算1+2+3……..+n的值(n是自然数) 输电线路大跨越方式有哪些请问有谁能用vb编程编一个积分公式吗 凯恩帝数控编程问题凯恩帝数控编程中跳段的/指令怎么编 vb编程:求a=1+3+5+.+(2n-1)的值Private Sub Form_click()Dim a As IntegerDim i As IntegerDim n As Integern = InputBox(n=)For i = 1 To n a = a + 2 * n - 1Next iPrint n=; n, a=; aEnd Sub怎么不对呢? VB里,怎么把常数2定义成双精度?下面是我编的程序,运行了,只算n=50的时候,n=1000就不算了,究竟怎么把常数2定义成双精度呢?Dim yuanzhoulv As Double, n As Double Private Sub Command1_Click()yuanzhoulv = 2For n = 1 T VB单击命令按钮,则文本框(text1)的英文句子按单词分解到列表框(list1),帮帮忙把代码补全(问号处)Private Sub Command1_Click() Dim S1 As String, S2 As String Dim I1 As Integer' S1 = ? I1 = 1 Do'