Results 1 to 11 of 11

Thread: [RESOLVED] I HATE LIST BOX's

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2007
    Posts
    31

    Resolved [RESOLVED] I HATE LIST BOX's

    ive been trying to get a list box input its list into a label on another form. i thought it worked but ive discovered that it only inputs the last entry i make.

    the code i have is
    Code:
    Form5.bui_lbl.Caption = spec_lst.List(spec_lst.Listcount - 1)
    i tried this code with i wonder if it mite be better with some proffesional tweeking?

    Code:
    Form5.bui_lbl.Caption = spec_lst.List(spec_lst.Listindex > 0)
    any help i'd be thankful?

  2. #2
    Member
    Join Date
    Jul 2007
    Posts
    59

    Re: I HATE LIST BOX's

    Quote Originally Posted by kps1
    ive been trying to get a list box input its list into a label on another form. i thought it worked but ive discovered that it only inputs the last entry i make.

    the code i have is
    Code:
    Form5.bui_lbl.Caption = spec_lst.List(spec_lst.Listcount - 1)
    i tried this code with i wonder if it mite be better with some proffesional tweeking?

    Code:
    Form5.bui_lbl.Caption = spec_lst.List(spec_lst.Listindex > 0)
    any help i'd be thankful?
    if your wanting it to display the current selected item in the list then
    just use this

    Code:
    Form5bui_lbl.caption = spec_lst.text

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jun 2007
    Posts
    31

    Re: I HATE LIST BOX's

    that didnt work sorry that makes it go blank it will be in an if statement because there will be 2 frames on top of eachother for the ifs will make the frames visibleand take information input form one form to the other. i know a case statment would work better but i like ifs more
    example
    Code:
    if bui_opt = true then
    form5.bui_frame.visible = true
    Form5.bui_lbl.Caption = spec_lst.Text
    end if
    there will be else if for the other statment for repair option

  4. #4
    Member
    Join Date
    Jul 2007
    Posts
    59

    Re: I HATE LIST BOX's

    Quote Originally Posted by kps1
    that didnt work sorry that makes it go blank it will be in an if statement because there will be 2 frames on top of eachother for the ifs will make the frames visibleand take information input form one form to the other. i know a case statment would work better but i like ifs more
    example
    Code:
    if bui_opt = true then
    form5.bui_frame.visible = true
    Form5.bui_lbl.Caption = spec_lst.Text
    end if
    there will be else if for the other statment for repair option
    If this doesnt help then I guess I have no idea what your going for.
    Attached Files Attached Files

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jun 2007
    Posts
    31

    Re: I HATE LIST BOX's

    nope thats not wot i want to do wot i have is a frame in which i have a label where i want my info to go.

  6. #6
    Member
    Join Date
    Jul 2007
    Posts
    59

    Re: I HATE LIST BOX's

    Quote Originally Posted by kps1
    nope thats not wot i want to do wot i have is a frame in which i have a label where i want my info to go.
    Just post your source or pm it to me and I will fix it in a few seconds

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Jun 2007
    Posts
    31

    Re: I HATE LIST BOX's

    thats all the button code if thats wot u been
    Code:
    Private Sub nxt_cmd_Click()
    Form3.Hide
    Form5.Show
    
        Form5.cmna1_lbl.Caption = Form2.ti_lbl.Caption
        Form5.cmna2_lbl.Caption = Form2.for_lbl.Caption
        Form5.cmna3_lbl.Caption = Form2.sur_lbl.Caption
        
           If Form4.rep_opt = True Then
            Form5.rep_frame.Visible = True
            Form5.type_lbl1.Caption = Form3.type_txt.Text
            Form5.man_lbl.Caption = Form3.man_txt.Text
            Form5.ser_lbl.Caption = Form3.ser_txt.Text
            Form5.case_lbl.Caption = Form3.cade_txt.Text
            Form5.fault_lbl.Caption = Form3.fau_txt.Text
        Else
               If Form4.build_opt = True Then
                Form5.bui_frame.Visible = True
                Form5.bui_lbl.Visible = True
                  Form5.bui_lbl.Caption = spec_lst.Text
                  
                  
                  
                
    End If
    End If

  8. #8
    Hyperactive Member
    Join Date
    Oct 2001
    Location
    Washington DC
    Posts
    314

    Re: I HATE LIST BOX's

    Code:
    Option Explicit
    
    Private Sub Command1_Click()
    Dim W As String, i As Integer
    For i = 0 To List1.ListCount - 1
      W = W + List1.List(i) + Chr$(10) + Chr$(13)
    Next i
    Form2.Show
    Form1.Visible = False
    Form2.Label1.Caption = W
    End Sub
    
    Private Sub Form_Load()
    Dim i As Integer
    For i = 1 To 5: List1.AddItem "Listbox Line" + Str$(i): Next i
    End Sub

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Jun 2007
    Posts
    31

    Re: I HATE LIST BOX's

    thats brilliant its works now thank you mr.mac
    thank you all

  10. #10
    Hyperactive Member
    Join Date
    Oct 2001
    Location
    Washington DC
    Posts
    314

    Re: [RESOLVED] I HATE LIST BOX's

    You're welcome.

    I fogot to show my form2:
    Private Sub Form_Unload(Cancel As Integer)
    Form1.Visible = True
    End Sub

    Necessary since otherwise Form1 runs forever, unnoticed. But I guess you know how to handle multi-form applications anyway.

    Mac

  11. #11

    Thread Starter
    Junior Member
    Join Date
    Jun 2007
    Posts
    31

    Re: [RESOLVED] I HATE LIST BOX's

    i took that bit of your code out i have a simplar way to do it
    form1.hide
    form2.show
    its a big button with a few things going on.

    ta

Posting Permissions

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



Click Here to Expand Forum to Full Width