Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
Tell me more
I'm working with windows form application in vb.net windows form application in that there are two buttons: 1. Add new Textbox 2. Insert multiple textbox data into database When I click on 1st button it will create new textbox and if I click on 2nd button than it should insert data of multiple textboxes in database. Database has two fields only 1. Id primary key 2. Name And textbox contains name. Please suggest me the way to implement this i have no idea about this.
vb.net textbox
Is the ID field auto-incremental? Ken - Abdias Software Nov 22 '12 at 15:25 Could you use a different control other than a textbox? Maybe a d a t a g r i d v i e w which you can add rows to and expand dynamically much easier than a group of text boxes. bendataclear Nov 22 '12 at 15:34 yes it's auto-increment. javed salat Nov 22 '12 at 15:34 Is it posiible by datagridview??? javed salat Nov 22 '12 at 15:35
closed as not a real question by Oded , lazyberezovsky, 0x499602D2, Marek Sebera, Graviton Nov 26 '12 at 3:44
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.
1 Answer
In your click-event assuming the ID-field is auto-incrementing in the database: d i mm y T x ta sN e wT e x t B o x m y T x t . N a m e=M e . C o n t r o l s . C o u n t . T o S t r i n g' " r a n d o m "n a m e m y T x t . L o c a t i o n=N e wP o i n t ( 1 0 ,1 0 )' s e tt h ep o s i t i o na c c o r d i n gt oy o u rl a y o u t m y T x t . T a g=" F o rD B "' s o m e t h i n gt oi d e n t i f yi tb y m y T x t . V i s i b l e=T r u e M e . C o n t r o l s . A d d ( m y T x t )' a d di tt of o r m ' sc o n t r o lc o l l e c t i o n . M e . R e f r e s h ' I fi np a n e le t c .c h a n g eM ew i t ht h a tc o n t r o l . Then in your second click event:
stackoverflow.com/questions/13515523/dynamically-add-textbox-on-button-click
1/2
6/2/13
Not the answer you're looking for? Browse other questions tagged vb.net textbox or ask your own question.
stackoverflow.com/questions/13515523/dynamically-add-textbox-on-button-click
2/2