Any way to address multiple textboxes with a button
Ok my title is probably very vague and unclear.
Kind of hard to sumerise in the title.
My form has a bunch of textboxes.
The content is supposed to be saved with a button.
BUT not all the textboxes will have content in them.
So lets say i added content to the 1st textbox/selected textbox.
I want it to save just that.
All textboxes have a different name of course.
So basically a generic name for all textboxes on the form.
But without clearing content which is already present in other textboxes.
Hope i am making somewhat sense here.
Have a feeling i dont.
Sevyt
Junior Poster in Training
59 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
I don't have access to VB while my computer is in the shop but let me make a suggestion (you'll have to verify the syntax). You can check all of the textboxes on the form by
For Each tbx As TextBox In Me.Controls.OfType(Of TextBox)()
If tbx.Text <> "" Then
'process textbox with content
End If
Next
If some of the textboxes do not need to be checked then you can either put all the ones to check in a groupbox and just check within that group, or you could place some value in the Tag property of each textbox to check and ignore the ones without that value.
So lets say i added content to the 1st textbox/selected textbox.
I want it to save just that.
You can't check only the selected textbox because by clicking the button you deselect the textbox.
Reverend Jim
Carpe per diem
3,627 posts since Aug 2010
Reputation Points: 563
Solved Threads: 452
Skill Endorsements: 32
I used to do it the hard way too until someone else here did to me what I did to you ;D
Reverend Jim
Carpe per diem
3,627 posts since Aug 2010
Reputation Points: 563
Solved Threads: 452
Skill Endorsements: 32
Alright another less learned.
Works the way i needed it.
Thanks guys.
Sevyt
Junior Poster in Training
59 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Question Answered as of 5 Months Ago by
john.knapp
and
Reverend Jim