|
|
#1 |
|
Member
Join Date: Apr 05
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 |
|
Frenzied Member
Join Date: Mar 03
Location: Utah
Posts: 1,065
![]() |
Re: something missing myself
The last 2 are looking for the same string.... Is that code copy and pasted?
|
|
|
|
|
|
#3 |
|
Member
Join Date: Apr 05
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 |
|
Guru
Join Date: Jan 99
Location: Interactive Medica
Posts: 11,086
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: something missing myself
"General" and "Backup" are both showing Frame1.
__________________
Joacim Andersson Microsoft MVP, MCSD, MCSE, Sun Certified Java Programmer If anyones answer has helped you please show your appreciation by rating that answer. I'd rather run ScriptBrix... Joacim's view on stuff. |
|
|
|
|
|
#5 |
|
Snarky...
Join Date: May 02
Posts: 15,476
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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 requests for help. It's not conducive to the general learning of others.-I also subscribe to all threads I participate, so there's no need to pm when there's an update.* * 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??? * On Error Resume Next is error ignoring, not error handling(tm). * Use Offensive Programming, not Defensive Programming. "There is a major problem with your code, and VB wants to tell you what it is.. but you have decided to put your fingers in your ears and shout 'I'm not listening!'" - si_the_geek on using OERN MVP '06-'10 |
|
|
|
|
|
#6 |
|
Member
Join Date: Apr 05
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 |
|
Oi, fat-rag!
Join Date: Mar 04
Location: on the poop deck
Posts: 5,581
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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:
__________________
Take a moment to rate useful posts VB6 CodeBank: Glass Form & Tracing App , MouseWheel with Any Control , Form Previewer Utility VB6 Snippets: RTB: Disable Smooth Scrolling , Form: Left & Right Justified Text in TitleBar , ListBox: As-You-Type Filtering (fast) , MSFlexGrid: Non-Adjacent Col/Row Selection , IsProcessRunning: PSAPI / WMI , PictureBox: Frame Look-A-Like , Open Folder in a Particular View , Form: Always on Bottom VBA Snippet: Generic Mouseover Workaround |
|
|
|
|
|
#8 |
|
Member
Join Date: Apr 05
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 |
|
Oi, fat-rag!
Join Date: Mar 04
Location: on the poop deck
Posts: 5,581
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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:
__________________
Take a moment to rate useful posts VB6 CodeBank: Glass Form & Tracing App , MouseWheel with Any Control , Form Previewer Utility VB6 Snippets: RTB: Disable Smooth Scrolling , Form: Left & Right Justified Text in TitleBar , ListBox: As-You-Type Filtering (fast) , MSFlexGrid: Non-Adjacent Col/Row Selection , IsProcessRunning: PSAPI / WMI , PictureBox: Frame Look-A-Like , Open Folder in a Particular View , Form: Always on Bottom VBA Snippet: Generic Mouseover Workaround |
|
|
|
|
|
#10 |
|
Guru
Join Date: Jan 99
Location: Interactive Medica
Posts: 11,086
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: something missing myself
I think the ItemClick event is a better choice over the Click event.
__________________
Joacim Andersson Microsoft MVP, MCSD, MCSE, Sun Certified Java Programmer If anyones answer has helped you please show your appreciation by rating that answer. I'd rather run ScriptBrix... Joacim's view on stuff. |
|
|
|
|
|
#11 |
|
Oi, fat-rag!
Join Date: Mar 04
Location: on the poop deck
Posts: 5,581
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: something missing myself
I've never really used a ListView, so I suspected there might have been something better
__________________
Take a moment to rate useful posts VB6 CodeBank: Glass Form & Tracing App , MouseWheel with Any Control , Form Previewer Utility VB6 Snippets: RTB: Disable Smooth Scrolling , Form: Left & Right Justified Text in TitleBar , ListBox: As-You-Type Filtering (fast) , MSFlexGrid: Non-Adjacent Col/Row Selection , IsProcessRunning: PSAPI / WMI , PictureBox: Frame Look-A-Like , Open Folder in a Particular View , Form: Always on Bottom VBA Snippet: Generic Mouseover Workaround |
|
|
|
|
|
#12 |
|
Member
Join Date: Apr 05
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.
|
|
|
|
|
|
#13 |
|
Oi, fat-rag!
Join Date: Mar 04
Location: on the poop deck
Posts: 5,581
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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.
__________________
Take a moment to rate useful posts VB6 CodeBank: Glass Form & Tracing App , MouseWheel with Any Control , Form Previewer Utility VB6 Snippets: RTB: Disable Smooth Scrolling , Form: Left & Right Justified Text in TitleBar , ListBox: As-You-Type Filtering (fast) , MSFlexGrid: Non-Adjacent Col/Row Selection , IsProcessRunning: PSAPI / WMI , PictureBox: Frame Look-A-Like , Open Folder in a Particular View , Form: Always on Bottom VBA Snippet: Generic Mouseover Workaround |
|
|
|
|
|
#14 |
|
Member
Join Date: Apr 05
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 07:47 PM. |
|
|
|
|
|
#15 |
|
Oi, fat-rag!
Join Date: Mar 04
Location: on the poop deck
Posts: 5,581
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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:
__________________
Take a moment to rate useful posts VB6 CodeBank: Glass Form & Tracing App , MouseWheel with Any Control , Form Previewer Utility VB6 Snippets: RTB: Disable Smooth Scrolling , Form: Left & Right Justified Text in TitleBar , ListBox: As-You-Type Filtering (fast) , MSFlexGrid: Non-Adjacent Col/Row Selection , IsProcessRunning: PSAPI / WMI , PictureBox: Frame Look-A-Like , Open Folder in a Particular View , Form: Always on Bottom VBA Snippet: Generic Mouseover Workaround |
|
|
|
|
|
#16 |
|
Member
Join Date: Apr 05
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 |
|
Oi, fat-rag!
Join Date: Mar 04
Location: on the poop deck
Posts: 5,581
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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
__________________
Take a moment to rate useful posts VB6 CodeBank: Glass Form & Tracing App , MouseWheel with Any Control , Form Previewer Utility VB6 Snippets: RTB: Disable Smooth Scrolling , Form: Left & Right Justified Text in TitleBar , ListBox: As-You-Type Filtering (fast) , MSFlexGrid: Non-Adjacent Col/Row Selection , IsProcessRunning: PSAPI / WMI , PictureBox: Frame Look-A-Like , Open Folder in a Particular View , Form: Always on Bottom VBA Snippet: Generic Mouseover Workaround |
|
|
|
|
|
#18 |
|
Guru
Join Date: Jan 99
Location: Interactive Medica
Posts: 11,086
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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.
__________________
Joacim Andersson Microsoft MVP, MCSD, MCSE, Sun Certified Java Programmer If anyones answer has helped you please show your appreciation by rating that answer. I'd rather run ScriptBrix... Joacim's view on stuff. |
|
|
|
|
|
#19 |
|
Member
Join Date: Apr 05
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 |
|
Oi, fat-rag!
Join Date: Mar 04
Location: on the poop deck
Posts: 5,581
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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
__________________
Take a moment to rate useful posts VB6 CodeBank: Glass Form & Tracing App , MouseWheel with Any Control , Form Previewer Utility VB6 Snippets: RTB: Disable Smooth Scrolling , Form: Left & Right Justified Text in TitleBar , ListBox: As-You-Type Filtering (fast) , MSFlexGrid: Non-Adjacent Col/Row Selection , IsProcessRunning: PSAPI / WMI , PictureBox: Frame Look-A-Like , Open Folder in a Particular View , Form: Always on Bottom VBA Snippet: Generic Mouseover Workaround |
|
|
|
|
|
#21 |
|
Guru
Join Date: Jan 99
Location: Interactive Medica
Posts: 11,086
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: something missing myself
The controls that should go on a Frame must be "drawn" on the Frame and not on the Form.
__________________
Joacim Andersson Microsoft MVP, MCSD, MCSE, Sun Certified Java Programmer If anyones answer has helped you please show your appreciation by rating that answer. I'd rather run ScriptBrix... Joacim's view on stuff. |
|
|
|
![]() |
|
||||||
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|