Results 1 to 7 of 7
  1. #1
    New Lounger
    Join Date
    Sep 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    display (visual basic)

    I am having a small problem. I'm trying to write a code so that I can display information that is located in different tabs onto one label on the form. I am able to do that part the problem is I need to have a check box for the different pieces of information such as student name, id #, address and so on and you should be able to only display the information you want to see such as name and address only or name and major with the click of a button. I tried using If statements and it would only return one item no matter how many were checked.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: display (visual basic)

    Do you have an If...End If for each checkbox, or an If...ElseIf...ElseIf...End If that contains everything in one structure? You need to use the first one because an If...End If will exit after the first match.

  3. #3
    New Lounger
    Join Date
    Sep 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: display (visual basic)

    I tried both and neither works....I keep just getting one response instead of all of the boxes that I checked.

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: display (visual basic)

    It may not be possible to diagnose this one without seeing the code. I don't know whether you can post it (in a ZIP file or a TXT file) or not.

  5. #5
    New Lounger
    Join Date
    Sep 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: display (visual basic)

    here is the code for that specific part...if you need more let me know.

  6. #6
    New Lounger
    Join Date
    Sep 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: display (visual basic)

    i figured it out...did seperate labels...sorry to have bothered you with it...im brand new to VB

  7. #7
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: display (visual basic)

    Depending on how you want the items displayed, this might get you started:

    <pre>Private Sub btnStudentInformation_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    'Handles btnStudentInformation.Click
    'this button will display all student information that has been selected
    'in the student information checkbox.
    .Text = ""
    With lblStudentInformation
    If chkAdDate.Checked Then
    .Text = .Text & txtAdmissionDate.Text
    End If

    If chkStuMaj.Checked Then
    .Text = .Text & lstMajor.SelectedItem
    End If

    If chkStuAdv.Checked Then
    .Text = .Text & comboxAdmissionAllowedBy.SelectedItem
    End If

    If chkAdd.Checked Then
    .Text = .Text & txtStreet.Text & txtCity.Text & txtState.Text & txtZip.Text
    End If

    End With
    End Sub
    </pre>

    Legare Coleman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •