To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
Part 10 of the Visual Basic .NET 2010 Express Tutorial Complete!
How to Use the Visual Studio Code Analysis Tool FxCop
Article :: Interview with Andrei Alexandrescu (Part 3 of 3)
Introducing Visual Studio LightSwitch
Visual Studio LightSwitch Beta 1 is Available



Go Back   VBForums > Visual Basic > Visual Basic 6 and Earlier

Reply Post New Thread
 
Thread Tools Display Modes
Old Mar 28th, 2006, 03:04 PM   #1
Alidad
Member
 
Join Date: Apr 05
Posts: 38
Alidad is an unknown quantity at this point (<10)
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
Alidad is offline   Reply With Quote
Old Mar 28th, 2006, 03:37 PM   #2
Spajeoly
Frenzied Member
 
Spajeoly's Avatar
 
Join Date: Mar 03
Location: Utah
Posts: 1,065
Spajeoly is on a distinguished road (20+)
Re: something missing myself

The last 2 are looking for the same string.... Is that code copy and pasted?
Spajeoly is offline   Reply With Quote
Old Mar 28th, 2006, 04:35 PM   #3
Alidad
Member
 
Join Date: Apr 05
Posts: 38
Alidad is an unknown quantity at this point (<10)
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!
Alidad is offline   Reply With Quote
Old Mar 28th, 2006, 04:40 PM   #4
Joacim Andersson
Guru
 
Joacim Andersson's Avatar
 
Join Date: Jan 99
Location: Interactive Medica
Posts: 11,086
Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)
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.
Joacim Andersson is offline   Reply With Quote
Old Mar 28th, 2006, 04:41 PM   #5
techgnome
Snarky...
 
techgnome's Avatar
 
Join Date: May 02
Posts: 15,476
techgnome has a brilliant future (2000+)techgnome has a brilliant future (2000+)techgnome has a brilliant future (2000+)techgnome has a brilliant future (2000+)techgnome has a brilliant future (2000+)techgnome has a brilliant future (2000+)techgnome has a brilliant future (2000+)techgnome has a brilliant future (2000+)techgnome has a brilliant future (2000+)techgnome has a brilliant future (2000+)techgnome has a brilliant future (2000+)
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
techgnome is offline   Reply With Quote
Old Mar 28th, 2006, 05:45 PM   #6
Alidad
Member
 
Join Date: Apr 05
Posts: 38
Alidad is an unknown quantity at this point (<10)
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
Alidad is offline   Reply With Quote
Old Mar 28th, 2006, 05:52 PM   #7
bushmobile
Oi, fat-rag!
 
bushmobile's Avatar
 
Join Date: Mar 04
Location: on the poop deck
Posts: 5,581
bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)
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"
bushmobile is offline   Reply With Quote
Old Mar 28th, 2006, 06:49 PM   #8
Alidad
Member
 
Join Date: Apr 05
Posts: 38
Alidad is an unknown quantity at this point (<10)
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!
Alidad is offline   Reply With Quote
Old Mar 28th, 2006, 07:02 PM   #9
bushmobile
Oi, fat-rag!
 
bushmobile's Avatar
 
Join Date: Mar 04
Location: on the poop deck
Posts: 5,581
bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)
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
File Type: zip ShowFrame.zip (1.6 KB, 11 views)
bushmobile is offline   Reply With Quote
Old Mar 28th, 2006, 07:13 PM   #10
Joacim Andersson
Guru
 
Joacim Andersson's Avatar
 
Join Date: Jan 99
Location: Interactive Medica
Posts: 11,086
Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)
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.
Joacim Andersson is offline   Reply With Quote
Old Mar 28th, 2006, 07:15 PM   #11
bushmobile
Oi, fat-rag!
 
bushmobile's Avatar
 
Join Date: Mar 04
Location: on the poop deck
Posts: 5,581
bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)
Re: something missing myself

I've never really used a ListView, so I suspected there might have been something better
bushmobile is offline   Reply With Quote
Old Mar 28th, 2006, 07:26 PM   #12
Alidad
Member
 
Join Date: Apr 05
Posts: 38
Alidad is an unknown quantity at this point (<10)
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
File Type: zip Autofill.zip (51.1 KB, 9 views)
Alidad is offline   Reply With Quote
Old Mar 28th, 2006, 07:30 PM   #13
bushmobile
Oi, fat-rag!
 
bushmobile's Avatar
 
Join Date: Mar 04
Location: on the poop deck
Posts: 5,581
bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)
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.
bushmobile is offline   Reply With Quote
Old Mar 28th, 2006, 07:43 PM   #14
Alidad
Member
 
Join Date: Apr 05
Posts: 38
Alidad is an unknown quantity at this point (<10)
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.
Alidad is offline   Reply With Quote
Old Mar 28th, 2006, 07:53 PM   #15
bushmobile
Oi, fat-rag!
 
bushmobile's Avatar
 
Join Date: Mar 04
Location: on the poop deck
Posts: 5,581
bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)
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
bushmobile is offline   Reply With Quote
Old Mar 28th, 2006, 08:03 PM   #16
Alidad
Member
 
Join Date: Apr 05
Posts: 38
Alidad is an unknown quantity at this point (<10)
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!
Alidad is offline   Reply With Quote
Old Mar 28th, 2006, 08:06 PM   #17
bushmobile
Oi, fat-rag!
 
bushmobile's Avatar
 
Join Date: Mar 04
Location: on the poop deck
Posts: 5,581
bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)
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
bushmobile is offline   Reply With Quote
Old Mar 28th, 2006, 08:07 PM   #18
Joacim Andersson
Guru
 
Joacim Andersson's Avatar
 
Join Date: Jan 99
Location: Interactive Medica
Posts: 11,086
Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)
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.
Joacim Andersson is offline   Reply With Quote
Old Mar 28th, 2006, 08:17 PM   #19
Alidad
Member
 
Join Date: Apr 05
Posts: 38
Alidad is an unknown quantity at this point (<10)
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!
Alidad is offline   Reply With Quote
Old Mar 28th, 2006, 08:29 PM   #20
bushmobile
Oi, fat-rag!
 
bushmobile's Avatar
 
Join Date: Mar 04
Location: on the poop deck
Posts: 5,581
bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)bushmobile is a splendid one to behold (700+)
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
bushmobile is offline   Reply With Quote
Old Mar 28th, 2006, 08:41 PM   #21
Joacim Andersson
Guru
 
Joacim Andersson's Avatar
 
Join Date: Jan 99
Location: Interactive Medica
Posts: 11,086
Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)Joacim Andersson is a name known to all (1000+)
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.
Joacim Andersson is offline   Reply With Quote
Reply

Go Back   VBForums > Visual Basic > Visual Basic 6 and Earlier


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:25 AM.





Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.