Click here to Skip to main content
15,884,176 members

How to create label and 10 textbox every 1 hour

Member 9989624 asked:

Open original thread
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

VB
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


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.
Tags: Visual Basic

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900