Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: 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()
 
<pre>
    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.
Posted 20-Apr-13 22:14pm
Comments
ThePhantomUpvoter at 21-Apr-13 5:30am
   
So what exactly is the problem? There is no timer code here at all. An no where are you checking the system time.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

DO loop with a switch statement heres how 2 get the time
 
Dim time As String
While True
 
<pre>
Select Case time
    Case "1:20"
   //do code
        Exit Select
    Case "12:20"
      //do code
        Exit Select
End Select

End While

  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 490
1 Sergey Alexandrovich Kryukov 405
2 Maciej Los 285
3 ProgramFOX 265
4 Peter Leow 210
0 OriginalGriff 490
1 Sergey Alexandrovich Kryukov 405
2 Maciej Los 285
3 ProgramFOX 265
4 Peter Leow 210


Advertise | Privacy | Mobile
Web02 | 2.8.150331.1 | Last Updated 22 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100