insert the text boxes at run time

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • coolminded
    New Member
    • Mar 2007
    • 137

    insert the text boxes at run time

    is it possible to insert the no, of text boxes at the run time. i want the messages to be in the text boxes rather than message box.
  • vijaydiwakar
    Contributor
    • Feb 2007
    • 579

    #2
    Originally posted by coolminded
    is it possible to insert the no, of text boxes at the run time. i want the messages to be in the text boxes rather than message box.
    yes
    for that create ctrl array and use following code
    Code:
     
    Private Sub Form_Load()
    Load Text1(1)
    Text1(1).Visible = True
    Text1(1).Left = Me.Left
    Text1(1).Top = Me.Top
    End Sub

    Comment

    • coolminded
      New Member
      • Mar 2007
      • 137

      #3
      hi
      i have to show the values of no. of record in the text boxes. when i click any button, the values should be displayed in the text boxes one by one. now i am showing the values in the same text box. when i click any button, the previous value disappears and the new value is displayed. i want to store all the values shown in the text box and to display too.
      as we can show the values of the recordset in the datagrid, i want to show it in the textboxes. in the datagrid, the no. of rows increases as the data increases, likewise i want to show the data in the textbox and increase the no. as the data increases.

      Comment

      • vijaydiwakar
        Contributor
        • Feb 2007
        • 579

        #4
        Originally posted by coolminded
        hi
        i have to show the values of no. of record in the text boxes. when i click any button, the values should be displayed in the text boxes one by one. now i am showing the values in the same text box. when i click any button, the previous value disappears and the new value is displayed. i want to store all the values shown in the text box and to display too.
        as we can show the values of the recordset in the datagrid, i want to show it in the textboxes. in the datagrid, the no. of rows increases as the data increases, likewise i want to show the data in the textbox and increase the no. as the data increases.
        see its not a good practise
        but still ua may handle this case using xml file or notepad file
        link each record with the index of text box and some other related details

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          Originally posted by coolminded
          i have to show the values of no. of record in the text boxes. when i click any button, the values should be displayed in the text boxes one by one. now i am showing the values in the same text box. when i click any button, the previous value disappears and the new value is displayed. i want to store all the values shown in the text box and to display too.
          as we can show the values of the recordset in the datagrid, i want to show it in the textboxes. in the datagrid, the no. of rows increases as the data increases, likewise i want to show the data in the textbox and increase the no. as the data increases.
          If you are using VB6, then as vijaydiwakar pointed out in his first response, you can use a control array. This allows you to add more elements (in this case, textboxes) at runtime.

          If you are using VB.Net then I have no idea how you add controls at runtime.

          One thing to keep in mind. If you know the maximum number of textboxes you will need, you could create them all at design time, then just set their Visible property to hide or show them.

          Comment

          Working...