求VB代码数条 先谢谢各位前辈啦 我是小白 呵呵 350238281我QQ VB业余爱好 第一条 名称:自动排版代码 要求
呵呵!!! 不详细!
第一
aa = split(s,vbcrlf)
ss=""
for i=lbound(aa) to ubound(aa)
ss=ss + " " + aa(i) + vbcrlf + vbcrlf
next
第二
key_press 事件 加入 if ascii=asc("""") then sendkeys("""")
如果没有特殊要求,那就按照轮流的方法去实现好了:
A B C D E
第 1天 早班 中班 夜班 休息 休息
第 2天 休息 早班 中班 夜班 休息
第 3天 休息 休息 早班 中班 夜班
第 4天 夜班 休息 休息 早班 中班
第 5天 中班 夜班 休息 休息 早班
================================================
第 6天 早班 中班 夜班 休息 休息
第 7天 休息 早班 中班 夜班 休息
第 8天 休息 休息 早班 中班 夜班
第 9天 夜班 休息 休息 早班 中班
第10天 中班 夜班 休息 休息 早班
================================================
......
可以发现,5天一个轮次,第6天重复第1天的,第7天重复第2天的,......
我先介绍直接在窗体上输出一个月的安排吧!
Option Explicit
Private Sub Command1_Click()
Dim d(1 To 5) As String
Dim MaxDay As Integer
Dim i As Integer
Dim j As Integer
Dim LS As String
d(1) = "早班"
d(2) = "中班"
d(3) = "夜班"
d(4) = "休息"
d(5) = "休息"
MaxDay = Val(InputBox("请输入当月天数!"))
Print "A", "B", "C", "D", "E"
For i = 1 To MaxDay
If i > 5 Then
j = i Mod 5
If j = 0 Then j = 5
Else
j = i
End If
Debug.Print j, d(j)
Print d(j),
If i Mod 5 = 0 Then
Print
LS = d(1)
For j = 1 To 4
d(j) = d(j + 1)
Next j
d(5) = LS
End If
Next i
End Sub
比如这样,看是这个意思吗?
你有一个text1控件
Private Sub Command1_Click()
Text1.Text = Chr(32) & Chr(32) & Chr(32) & Chr(32) & Trim(Text1.Text) & Chr(13)
End Sub
不过这样呢,只有文本中的第一段,第二段就没有了。
你再想想用什么办法把text控件中的其它内容读出来吧。
1.
arrl=split(text1.text,vbcrlf)
text1.text=""
for i=0 to ubound(arrl)
text1.text=text1.text & trim(arrl(i)) & vbcrlf & vbcrlf
next
2.
Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
tema = Right(Text1, 1)
If tema = """" Or tema = "“" Or tema = "”" Or tema = "’" Or tema = "‘" Or tema = "'" Then
Text1 = Left(Text1, Len(Text1) - 1) & "“”"
End If
End Sub
2121
郁兰香砂: 新建一个VB工程,双击窗体把复制下面代码即可.Option Explicit Private sCount As Long Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) Select Case KeyCode Case 49 '加1 If Shift = 2 Then Form1.Caption = "CTRL + 1" ...
龙城区13953079016: 请求简单的vb代码 - ?
郁兰香砂: print 1234 '在窗体上打印1234 debug.print 1234 '在调试窗口打印1234
龙城区13953079016: 急求VB程序完整代码 - ?
郁兰香砂: Private Sub Form_Click() Dim x As Integer, a As Integer, b As Integer, c As Integer Form1.Cls Print "水仙花数为:" For a = 1 To 9 For b = 0 To 9 For c = 0 To 9 If a ^ 3 + b ^ 3 + c ^ 3 = 100 * a + 10 * b + c Then x = 100 * a + 10 * b + c Print Tab(15); "" & x & "" End If Next c Next b Next a End Sub 点几窗体就会显示水仙花数
龙城区13953079016: 求一个VB简单程序代码 - ?
郁兰香砂: 以下程序可以运行,添加5个文本框用于显示,一个按钮.Private Sub Command1_Click() Dim val(1 To 60) As Integer Dim pass%, good%, i%, j%, temp%, sum%'输入60个学生的成绩 For i = 1 To 60 val(i) = InputBox("输入第" & i & "个学生的...
龙城区13953079016: 高分急求一个简单的VB小游戏程序代码和控件,名字叫记忆牌,感谢各位了!可以用的话可以追加哦! - ?
郁兰香砂: 工程我已发Dim b(0 To 8)Dim m, k, nPrivate Sub Command1_Click()a = "012345678"For i = 0 To 8Randomize...
龙城区13953079016: 求VB的一条代码 - ?
郁兰香砂: '添加一个Timer控件,并设置Timer1的Enabled属性为False,Interval属性为1000(即1秒)'添加一个按钮'以下为代码 Private Sub Command1_Click() Timer1.Enabled = True End Sub Private Sub Timer1_Timer() SendKeys "A" '每隔1秒发送一个“A” End Sub
龙城区13953079016: 求一个VB代码?
郁兰香砂: 提示:两个事件+一个属性 鼠标在标签上的移动:标签的mouseover和mouseout事件 标签文字下划线:标签的font属性
龙城区13953079016: 急求VB计算器的编程代码 - ?
郁兰香砂: 控件:3个标签(text1~3) 从左到右2个标签(label1~2) 从左到右5个按钮(command1~5) 从左到右 代码:Private Sub Command1_Click() Label1.Caption = "+" End SubPrivate Sub Command2_Click() Label1.Caption = "-" End ...
龙城区13953079016: 求个VB代码?
郁兰香砂: '用InputBox再输入n个数,求最大值和平均值. Option Explicit: Option Base 1 Private Sub Command1_Click() Dim n As Integer, i As Integer, a() As Double, j As Integer, max As Double, s As Double Dim Min As Double n = InputBox("请输入学...
龙城区13953079016: 求个VB代码?
郁兰香砂: Sub abc() dim Score(n)=(score0,score2,...,score(n-1)) dim AllScore as integer dim MaxScore as interger dim MinScore as interger dim AverageScore as interger dim i as integer MaxScore=score(0) Minscore=score(0) For i=0 to n-1Allscore=...