Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have 10 textboxes class1,class2....class10 like that
when in enter values in to textboxes it will be stored into database class1,class2..class10.this is ok. and then i need to store all 10 values in one column (class0) ( 20,21,22..29) can any one help me
Posted
Comments
Rob Branaghan 26-May-11 5:26am    
Why dont you just concatenate them with a comma seperator?

Any particular reason why you want them all in one column?

1 solution

assuming you only have 10 textboxes on one form you can either

VB
Dim Str as string = ""

for each ctrl as control on form1.controls
 if typeof ctrl is textbox then
   if str.length = "" then
     str += ctrl.text
   else
     str += "," ctrl.text
   end
 end if
next


or

VB
dim str as string = ""
str = textbox1.text & "," & textbox2.text & "," textbox3.text
 
Share this answer
 
Comments
Rob Branaghan 26-May-11 5:32am    
Damn, beat me to it! :)
Simon_Whale 26-May-11 5:39am    
sorry :)
Rob Branaghan 26-May-11 5:41am    
Saved me writting it so 5/5 :D
pugazhbala 27-May-11 3:23am    
hi,
I already tried this way,if i left atlest one textbox to blank the would not store to database,any other idea please
Simon_Whale 27-May-11 3:56am    
does it give you an error message? how does the string look like if you leave a textbox blank?

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



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