第三题:
Private Sub Option1_Click()
Text1.ForeColor = vbRed
End Sub
Private Sub Option2_Click()
Text1.ForeColor = vbYellow
End Sub
Private Sub Option3_Click()
Text1.ForeColor = vbGreen
End Sub
Private Sub Option4_Click()
Text1.ForeColor = vbBlack
End Sub
第二题:CommonDialog1打开电脑的文件 写入text1中,然后再选择路径保存!
Dim filenum As String
Private Sub Command1_Click()
Dim strfilename As String
Dim strline As String
CommonDialog1.Filter = "所有文件(*.*)|*.*"
CommonDialog1.FilterIndex = 1
CommonDialog1.ShowOpen
strfilename = CommonDialog1.FileName
Text1.Text = ""
filenum = FreeFile
If strfilename <> "" Then
Open strfilename For Input As filenum
Do While Not EOF(filenum)
Line Input #filenum, strline
Text1.Text = Text1.Text + strline + Chr(13) + Chr(10)
Loop
Close filenum
End If
End Sub
Private Sub Command2_Click()
CommonDialog2.Filter = "文本文件(*.txt)|*.txt"
CommonDialog2.FilterIndex = 1
CommonDialog2.ShowSave
strfilename = CommonDialog2.FileName
filenum = FreeFile
If strfilename <> "" Then
Open strfilename For Output As filenum
Print #filenum, Text1.Text
Close filenum
End If
End Sub
第一题
Private Sub Command1_Click()
For i = 100 To 999
If (Val(Mid(i, 1, 1)) ^ 3 + Val(Mid(i, 2, 1)) ^ 3 + Val(Mid(i, 3, 1)) ^ 3) = i Then
Text1.Text = Text1.Text & Str(i)
End If
Next i
End Sub
算得的水仙花种数153 370 371 407