如何每1小时创建一个标签和10个文本框 [英] How to create label and 10 textbox every 1 hour

查看:76
本文介绍了如何每1小时创建一个标签和10个文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

团队,



我需要你的帮助,每一小时创建一个标签和10个文本框(一个在另一个下面)。在vb.net。



我使用下面的代码自动创建文本框



Team,

i need your help in creating 1 label and 10 textboxs( one below another ) for every one hour. in vb.net.

I use below code to create textboxes automatically

Public Class Form1
Private new_Textboxes() As TextBox = {}
Private Sub CreateDynamicControls()
Dim i As Integer = new_Textboxes.Length
ReDim Preserve new_Textboxes(i)
For Me.p = 1 To ListBox6.Items.Count
            For Each listboxitem In ListBox6.Items
                new_Textboxes(i) = New TextBox
                With new_Textboxes(i)
                    .Name = "TextBox" & i.ToString()
                    If new_Textboxes.Length < 2 Then
                        .SetBounds(210, 8, 100, 20)
                    Else
                        .Left = new_Textboxes(i - 1).Left
                        .Top = new_Textboxes(i - 1).Top + new_Textboxes(i - _
                            1).Height + 4
                        .Size = new_Textboxes(i - 1).Size
                    End If
                    .Tag = i
                End With
                Me.Controls.Add(new_Textboxes(i))
            Next listboxitem
        Next
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        CreateDynamicControls()
    End Sub
    Public Sub New()

        InitializeComponent()
        CreateDynamicControls()
    End Sub
End Sub
End Class





我试图连接计时器控件,但问题是我需要根据系统时序创建文本框和标签(如果当前时间是11:45),创建的标签应将文本保存为11:00到12:00。



如下所示。



系统时间是1:20标签要创建的是1:00到2:00

系统时间是12:20标签要创建的是12:00到1:00

系统时间是5:00要创建的标签是4: 00至5:00



每个标签盒下面应该有10个文本框。



谢谢提前。



I tried to connect timer controls, but the thing is i need to create textboxes and label based on the System timings like ( if the current time is 11:45 ) the label created should hold the text as 11:00 to 12:00.

like below.

system time is 1:20 label to be created is 1:00 to 2:00
system time is 12:20 label to be created is 12:00 to 1:00
system time is 5:00 label to be created is 4:00 to 5:00

under each label box there should be 10 textboxes created.

Thanks in advance.

推荐答案

带循环语句的DO循环继承人如何2获得时间



DO loop with a switch statement heres how 2 get the time

Dim time As String
While True

	Select Case time
		Case "1:20"
	   //do code
			Exit Select
		Case "12:20"
          //do code
			Exit Select
	End Select
End While


这篇关于如何每1小时创建一个标签和10个文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆