现在有Label(x)到 Label(y)
想用一个循环来使 Label(x)---Label(y)
自己读取数据库的值来赋值。
x比y小的。
..额,,
比如 我有 label1 ,label2 ,label3 ,label4 ,label5 ,label6 ,label7 ,label8 ,label9.
想用一个循环 ,来为这些 Label.caption 赋值
让这些Label.caption 自动读取数据库中的值,来赋值
数据库是 aaa .
1 2 3 4
a a a a
b b b b
c c c c
d d d d
Dim rs_add1 As New ADODB.Recordset
Dim sql1 As String
sql1 = "select * from 数据整体表 where 岗位=职责"
rs_add1.Open sql1, conn, adOpenKeyset, adLockPessimistic
x = 4
Do
Label(x).Caption = rs_add1.Fields(3)
rs_add1.Close
Loop While rs_add1.Fields(2) <> "职责"
vb中用循环使Label 赋值
Controls("label"&cstr(i)).Caption = cstr(i)next
如何使用For……Next语句给7个Label赋值
Me.Caption = "点击窗体“空白区”后相应的文本赋值给7个标签"End Sub
VB中控件名称循环如何实现?
可以用循环来实现的,结合窗体的Controls属性,达到引用空间组的成员的目的 代码如下:Private Sub command1_click()Dim i As Long For i = 1 To 10 Me.Controls("Label" & i).Caption = i Next i End Sub
vb中如何实现每隔0.5秒label里就增加0.5?
Private Sub Form_Load()Timer1.Interval = 500 Timer1.Enabled = True End Sub Private Sub Timer1_Timer()Label1.Caption = Val(Label1.Caption) + 0.5 End Sub
vb用循环怎样判断一组单选按钮其中一个被选中
Private Sub Command1_Click() For i = 0 To 3 If Option1(i).Value = True Then Label1.Caption = Option1(i).Caption + "被选中。" Next iEnd Sub
vb语句由label组成的一维数组,有十个元素,怎样用for循环将每个caption写...
Private Sub Command1_Click()Open Environ("USERPROFILE") & "\\桌面\\记事本.txt" For Output As #1 For i = 0 To 9 Print #1, Label1(i).Caption Next Close #1 Shell "c:\\windows\\notepad.exe " & Environ("USERPROFILE") & "\\桌面\\记事本.txt", vbNormalFocus '打开文本文件 End...
vb循环和条件判断
Label2.Caption = Label2.Caption & tmp & " "Next End Sub '冒泡排序法 Private Function BubbleSort2(ArrayToSort()) As Boolean Dim SortLoop As Long Dim HoldValue Dim ChangeMade As Boolean Dim endLoop As Long ChangeMade = True Do While ChangeMade ChangeMade = False For Sort...
vb如何在label中一秒钟或间隔多长时间增加一个文字?
dim aa as string Private Sub Form_Load()Timer1.Interval = 500 '半秒 Label1 = ""aa="撒谎房间啊合法拉夫阿哥斐然饭卡上的后方可哈市的风格上班"End Sub Private Sub Timer1_Timer()Static i As Long i = i + 1 Label1 = left(aa, i)If i > Len(aa) Then i = 0 Label1 = "...
VB 运行时可以向label控件中输入数据么
加一个label和一个textbox,不做改动,加入下面代码:Option Explicit Private Sub Form_Load()Text1.Visible = False Label1.Visible = True Label1.Height = 495 Label1.Top = 960 Label1.Left = 1320 Label1.Width = 2535 Text1.Height = 495 Text1.Top = 960 Text1.Left = 1320 Text1...
VB.NET中labeln,n值递增
'Imports System.Linq Dim n As Integer Dim lbl As Label = Controls.OfType(Of Label).First(Function(L As Label) L.Text = "labeln" & n) lbl.Text = "xxx"