Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7670737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:53:29+00:00 2026-05-31T15:53:29+00:00

VB.NET 2008 windows app form. I have a groupbox with several checkboxes, comboboxes, and

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T15:53:31+00:00Added an answer on May 31, 2026 at 3:53 pm

    Final EDIT (tested and confirmed):

    Public Class Form1
    
        Private Enum interiorTypes
    
            Rack
            RackShelf
            RackSlide
            RackDrawer
            BackPanel
            Shelf
            Drawer
            Light
            Fan
            Therm
    
        End Enum       
    
        Private Sub btnOrder_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOrder.Click
    
            Dim sb As New System.Text.StringBuilder
    
            For Each type As interiorTypes In System.Enum.GetValues(GetType(interiorTypes))
    
                Dim chk = CType(gbInterior.Controls.Find("c" & type.ToString(), True)(0), CheckBox)
                Dim cb = CType(gbInterior.Controls.Find("cb" & type.ToString(), True)(0), ComboBox)
                Dim tb = CType(gbInterior.Controls.Find("tb" & type.ToString(), True)(0), TextBox)
    
                If chk.Checked Then
                    sb.AppendFormat("{0} {1} {2}", chk.Text, cb.SelectedItem.ToString, tb.Text)
                    sb.AppendLine()
                End If
    
            Next
    
            MsgBox(sb.ToString, MsgBoxStyle.OkOnly, "Order Summary")
    
        End Sub
    
    End Class
    

    If you don’t have all 3 inputs for each Interior Type, then you will need to check for Nothingness. To go with your example of a missing ComboBox, after your Dim declarations inside your For loop, you could do:

    If chk.Checked Then
    
        sb.Append(chk.Text)
        If cb IsNot Nothing Then sb.Append(" " & cb.SelectedItem.ToString)
        sb.Append(" " & tb.Text)
        sb.AppendLine()
    
    End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

JI have written a .NET C# Windows Form app in Visual Studio 2008 that
I have a simple Windows App written in Visual Studio 2008 (.NET 3.0, C#).
I have a small .NET app that I'm running under Windows 2008 Server via
I have a .NET 4 app running on Windows Server 2008 R2 which I
I have built a windows service application in VB.net 2008, and used the Setup
I have a simple windows Service developed in VS.net 2008 and VB.net. When I
I have a very simple windows Service that is developed in vb.net 2008. When
I have just installed the Platform SDK for Windows Server 2008 and .NET 3.5
I'm deploying an asp.net mvc 2 app on windows 2008 R2 and I get
I have an ASP.NET page hosted on IIS6 running in windows 2008 server. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.