Results 1 to 21 of 21

Thread: something missing myself

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    38

    something missing myself

    Hi, i'm created three frames "frame1", "frame2" and "frame3", and that put top together, for sampel "frame2" is top of "frame1" and "frame3" is top of "frame2".

    i also created listview, and has three catagoreis "name1", "name2", "name3",

    if i want to click nameone it will show "frame1", if i want to click name2 it will show "frame2" and hide rest of frames, and if I want to click name3, it will show 'frame3" and hide rest of frames.

    but the problem is that every time i click name2 or name3 is not showing frame but works frame1, and i wrote code plesae take look. Any idea why!

    If ListView1.SelectedItem.Text = "General" Then
    Frame1.Visible = True
    Frame2.Visible = False
    frame3.visible = false

    Else If ListView1.SelectedItem.Text = "Security" Then
    Frame1.Visible = False
    Frame2.Visible = True
    frame3.visible = False

    elseIf ListView1.SelectedItem.Text = "Security" Then
    Frame1.Visible = True
    Frame2.Visible = False
    frame3.visible = False


    End If
    End If
    End sub

  2. #2
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068

    Re: something missing myself

    The last 2 are looking for the same string.... Is that code copy and pasted?

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    38

    Re: something missing myself

    yes sorry is suppose to be

    If ListView1.SelectedItem.Text = "General" Then
    Frame1.Visible = True
    Frame2.Visible = False
    frame3.visible = false

    Else If ListView1.SelectedItem.Text = "Security" Then
    Frame1.Visible = False
    Frame2.Visible = True
    frame3.visible = False

    elseIf ListView1.SelectedItem.Text = "Backup" Then
    Frame1.Visible = True
    Frame2.Visible = False
    frame3.visible = False


    End If
    End If
    End sub


    but still not working, wonder why! any idea!

  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: something missing myself

    "General" and "Backup" are both showing Frame1.

  5. #5
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: something missing myself

    Well, for "Backup" you're showing frame1 again.... same as you are for "General" ....

    The next question I have is what event are you using to run this code?


    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  6. #6

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    38

    Re: something missing myself

    why the world I'm so monkey that im typing to fast ane end up into wrong code. the code is suppose to be

    If ListView1.SelectedItem.Text = "General" Then
    Frame1.Visible = True
    Frame2.Visible = False
    frame3.visible = false

    Else If ListView1.SelectedItem.Text = "Security" Then
    Frame1.Visible = False
    Frame2.Visible = True
    frame3.visible = False

    elseIf ListView1.SelectedItem.Text = "Backup" Then
    Frame1.Visible = false
    Frame2.Visible = False
    frame3.visible = True

    Any idea why!

    or do i have to write zorder statments!

    End If
    End If
    End sub

  7. #7
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: something missing myself

    As tg said, we'd need to know what event you're using to run your code.

    Also, that code can be simplified to:

    VB Code:
    1. Frame1.Visible = ListView1.SelectedItem.Text = "General"
    2. Frame2.Visible = ListView1.SelectedItem.Text = "Security"
    3. Frame3.Visible = ListView1.SelectedItem.Text = "Backup"

  8. #8

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    38

    Re: something missing myself

    ____________________________________________________
    Frame1.Visible = ListView1.SelectedItem.Text = "General"
    Frame2.Visible = ListView1.SelectedItem.Text = "Security"
    Frame3.Visible = ListView1.SelectedItem.Text = "Backup"
    _____________________________________________________


    that have same problme again, One frame (General) overlay the other frame (Security), thired frame overlay the other frame (backup), so when user selected options (general) is works fine then i click "options" for security is not working, and if i click backup is works fine with frame.

    so what went wrong with that!

  9. #9
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: something missing myself

    That code was not meant to be a solution to your problem, just a shorter way of writing what you had posted in post #6.

    You still haven't told us how you are calling that code. You should probably be using the Click event, is that what you're doing?

    VB Code:
    1. Private Sub ListView1_Click()
    2.     Frame1.Visible = ListView1.SelectedItem.Text = "General"
    3.     Frame2.Visible = ListView1.SelectedItem.Text = "Security"
    4.     Frame3.Visible = ListView1.SelectedItem.Text = "Backup"
    5. End Sub
    Here's an example:

    Attached Files Attached Files

  10. #10
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: something missing myself

    I think the ItemClick event is a better choice over the Click event.

  11. #11
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: something missing myself

    I've never really used a ListView, so I suspected there might have been something better

  12. #12

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    38

    Re: something missing myself

    thanks for file, still not working one of mine, i enclosed my file and you see what the problme i have. I really appreication if anyone can help me what did i missed. and send file back so i can learn my mistake thanks.
    Attached Files Attached Files

  13. #13
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: something missing myself

    The problem is that you've put the security frame inside the general frame and the user frame inside the back up frame.

  14. #14

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    38

    Re: something missing myself

    thanks for reply, If you fixed that file, i apprication if you can send me back so i can learn myself becuase i still not sure where to put if not suppose to put inside of frame. thanks.
    Last edited by Alidad; Mar 28th, 2006 at 08:47 PM.

  15. #15
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: something missing myself

    i don't have one of the controls you have so the project would be resaved with that control missing if i change it (i think). Here's what you do:

    • Click on the security frame
    • Press Ctrl + X
    • Click on the form
    • Press Ctrl + V
    • Move the frame to where you want it

    then repeat that for the user frame

  16. #16

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    38

    Re: something missing myself

    thanks so much, you been helpful lots, can you tell me why we have to do this way by copy and paste over !

    so i do have same problme with user, all i have to do copy and paste over right!

  17. #17
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: something missing myself

    when you were drawing (or pasting) your frames you accidently drew some of them inside others. That means if the parent frame was not visible then neither was the frame within it, hence it not being shown when you set it's visible state to True.

    Just make sure that you're always pasting controls into container you want them to be in. Frames & pictureboxes can be containers for controls as well as the form itself.

    Don't forget to mark this thread resolved

  18. #18
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: something missing myself

    A Frame, as you probably know, is a container object. So one Frame can contain other controls... This is the problem you have... Your Frame is contained in another Frame instead of being contained directly on the Form.

    So that is why you should cut and paste the frame, so it is contained on the Form instead of inside the other Frame. I hope this makes sense to you.

  19. #19

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    38

    Re: something missing myself

    oh ok great thanks. last things is that if I want to put button or text filed to one of the frame, why is showing to all of frame! how can i do that to show one of frame rather then all frames!

  20. #20
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: something missing myself

    I don't really understand. What do you mean by "why is it showing to all of frame"? If i put a control on one of the frames then it's only visible when that frame is visible

  21. #21
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: something missing myself

    The controls that should go on a Frame must be "drawn" on the Frame and not on the Form.

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