Results 1 to 4 of 4

Thread: How to insert textbox on button click and save data in all the textboxes in db VB.net

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2017
    Posts
    110

    Exclamation How to insert textbox on button click and save data in all the textboxes in db VB.net

    Hi, I have a textbox named txtNumOfT where you can input the number of textboxes you want to insert (maximum is 9, minimum is 1) . When I click the insert textbox button, I want it to create the number of textboxes indicated on txtNumOfT textbox. After that, I'd like to change the name of each control to txtOp1 and so on. I'd also like to be able to save them into my database if I click on save to dab button.

    Please help. I have absolutely no idea how to do this

    UPDATE:

    Okay, so I have already resolved the part where I need to insert textboxes based on the number I entered on the txtNumOfT textbox. The only thing I need to know now is how to save them into the database.

    Code:
                Dim f As TextBox
                Dim i As Integer
                Dim a As Integer = Me.txtNumOfT.Text
                Dim l As Integer = 1
                For i = 1 To a
                    Me.TableLayoutPanel1.Controls.Add(New TextBox)
    
                Next
                For Each f In TableLayoutPanel1.Controls
                    f.Name = "txtBlank" & l.ToString()
                    f.Width = 147
                    f.Height = 24
    
                    l += 1
                Next
    Last edited by astrid22; Mar 17th, 2018 at 07:03 PM. Reason: code

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width