VB.NET 2008 windows app form. I have a groupbox with several checkboxes, comboboxes, and textboxes within it.
With the help of StackOverFlow members, I've learned how to use the FOR/NEXT loop to find all checkboxes that are checked.
Code:
Dim chk As CheckBox
Dim sb As New System.Text.StringBuilder
For Each chk In gbInterior.Controls.OfType(Of CheckBox)()
If chk.Checked Then
sb.AppendLine(chk.Text)
End If
Next chk
I am then using this information to write the checkbox names in the body of an email, using the following code:
Dim Outl As Object
Outl = CreateObject("Outlook.Application")
If Outl IsNot Nothing Then
Dim omsg As Object
omsg = Outl.CreateItem(0)
omsg.To = ""
omsg.Subject = "Cabinet Request"
omsg.Body = "A cabinet request has been created with the following information:" _
+ vbCrLf + sb.ToString
As you can see by the code sb.tostring will print every checked checkbox name on its own line...great. How do I associate the proper combobox.selecteditem, textbox.value, and checkbox name to print out on the same line. When I say proper...example; checkbox=pen, combobox=color, textbox=quantity.Let's say my other checkboxes are different items and the rest of the boxes are the same. Since I'm using a loop, how do I create the association? This is the result I'm looking for:
pen blue 1
pencil black 3
eraser pink 2
Thanks in advance