vb编程九九乘法表

Private Sub Command1_Click()
Dim i As Integer, j As Integer
For i = 1 To 9
For j = 1 To i
Print Tab((i - 1) * 8); i; "*"; j; "=" & i * j
Next j
Print
Next i
End Sub
这个哪里错了啊

因为在不该换行的地方换行了....
调用一次 print 完毕之后vb会自动跳到下一行...
做一个缓冲就好了,需要换行的时候再输出,否则放到strLine里面

Cls
Dim i As Integer, j As Integer
Dim strLine As String
For i = 1 To 9
For j = 1 To i
strLine = strLine & i & "*" & j & "=" & i * j & " "
Next j
Print strLine & vbCrLf
strLine = ""
Next i
温馨提示:内容为网友见解,仅供参考
第1个回答  2010-04-10
Private Sub Command1_Click()
Dim i As Integer, j As Integer
For i = 1 To 9
For j = 1 To i
Print Tab((j - 1) * 8); i; "*"; j; "=" & i * j;
Next j
Print
Print
Next i
End Sub
第2个回答  2010-04-11
Option Explicit

Private Sub Command1_Click()
Dim i&, j&
For i = 1 To 9
For j = 1 To i
Print " " & i; "*"; j; "=" & Format(i * j, "@@");
Next
Print
Next
End Sub
第3个回答  2010-04-12
Private Sub Command1_Click()
Dim i, j As Integer
For i = 1 To 9
For j = i To 9
Line (i * 200, j * 250)-(i * 200, j * 250)
ForeColor = i * j * 253'字体颜色
Print Space((i - 1) * 6); i & "×" & j & "=" & i * j
Next j
Next i
End Sub

绝对不错 ,还是渐变色显示(可取消此功能)

九九乘法表用vb怎么做出来?
用VB编写打印九九乘法表可以参考下面的代码:按钮单击代码 Private Sub Command1_Click()For i = 1 To 9 For j = 1 To i Print i & "*" & j & "=" & i * j & " ";Next j Print Next i End Sub

用VB编一个九九乘法表,程序应该怎么写,求救!
本示例使用Visual Basic编写了一个九九乘法表程序。以下为程序代码:在编写程序前,我们需要定义两个整型变量i和j,分别用于表示行数和列数,以及一个字符串变量str用于存储乘法表。通过设置Me.AutoRedraw = True,可以实现在输出过程中实时更新控件。使用For循环,遍历i从1到9。在循环内部,定义一个空字...

请问如何用编程编写九九乘法表(并写出操作步骤)?
1. 利用Access数据库创建交互式窗体,配置所需组件以实现人机交互。2. 第一个文本框输入数字,决定乘法表的行数。3. 第二个文本框展示生成的九九乘法表结果。代码讲解:九九乘法表的核心设计是使用两个嵌套的ForNext循环。大循环(i)控制行数,小循环(j)生成每一行的乘法和结果。代码简洁,易于理解...

怎么用VB打九九乘法表
三角形的九九乘法表 Private Sub Form_Load()Dim i, j, s For i = 1 To 9 For j = 1 To i s = s & j & "×" & i & "=" & IIf(Len(i * j) < 2, i * j & " ", i * j) & " "Next s = s & vbCrLf Next MsgBox s End Sub ...

用vb在文本框里输出九九乘法表
vb中输出九九乘法表,可以参考下面的代码:Private Sub Form_Click()For a = 1 To 9 For b = 1 To a Print b; "*"; a; "="; b * a;Next b Print Next a End Sub

利用VB语言编程:输出九九乘法表
上面的哪是九九乘法表啊 我这有两种 Private Sub Form_Load()Me.AutoRedraw = True Cls For j = 1 To 9 For k = 1 To 9 If k > j Then Exit For Print k & "*" & j & "=" & j * k; " ";Next k Print Next j End Sub '''Private Sub Form_Click()Dim i, j ...

用vb编写九九乘法表
用VB程序怎么做九九乘法表的步骤如下:创建显示结果的窗体:编写按钮宏 Private Sub Command1_Click()Dim a, b As Integer Dim s As String: s = ""For a = 1 To 9 For b = 2 To 9 s = s & a & "*" & b & "=" & b * a If b <> 9 Then s = s & Space(1) Else...

用VB程序怎么做九九乘法表?
Public Class Form1 Private Sub Button1_Click(sender As Object,e As EventArgs)Handles Button1.Click Dim i,j As Integer Dim se As String Label1.Text=""For i=1 To 9 Step 1 For j=1 To 9 Step 1 se=i&"x"&j&"="&i*j Label1.Text&=se&Space(10-Len(se))Next Label1....

怎样用vb在窗体上输出九九乘法表?
Private Sub Form_Click()Dim i, j As Integer Dim s As String Print Tab(35); "九九乘法表"For i = 1 To 9 For j = 1 To i s = i & "×" & j & "=" & i * j Print Tab((j - 1) * 9 + 2); s;Next j Print Next i End Sub ...

九九乘法表编程代码九九乘法表vb代码
关于九九乘法表编程代码,九九乘法表vb代码这个很多人还不知道,今天来为大家解答以上的问题,现在让我们一起来看看吧!1、private sub form1_click()dim i as integer,j as integerfor i = 1 to 9for j = 1 to iprint tab(4*j);i * j ;next jnext iend sub。本文到此分享完毕,希望对...

相似回答