Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 05-15-2005, 11:14 AM   #1
Baseband Member
 
Join Date: May 2005
Posts: 21
Default Sorting in VB

I want to produce a report of mymovie collection. Which fields would I use, and which would be the data types of each of those fields?


I also want to create a flowchart and pseudo-code for generating a report that prints all of the movies, with all movies made by the same director on one page, as well as the number of movies by each director.



Please check for me if the pseudo-code bellow is correct

Moviecollection()
Movietype= “”

If Director = Tom Jackson then
Movietype = “Action”
Else
If Director = Bill Adams
Movietype= “Comedy”
Else
If Movietype = Action then
Director = “Tom Jackson”
Else
If Movietype= Comedy Then
Director = “Bill Adams”
Else
Movietype = “Drama”
Endif
EndIf
EnfIf
EndIf

Return
__________________

mechboard is offline   Reply With Quote
Old 05-15-2005, 01:23 PM   #2
Fully Optimized
 
UK31337's Avatar
 
Join Date: Feb 2005
Posts: 2,776
Default

You should use

Code:
 Else If
instead of having it on the separate lines.

Other than that, I can't see any immediate problems, but my VB is a little rusty.
__________________

__________________
Master of common sense. If you don't like it, stop reading.
UK31337 is offline   Reply With Quote
Old 05-15-2005, 08:38 PM   #3
Daemon Poster
 
ACES WILD's Avatar
 
Join Date: Feb 2005
Posts: 833
Default

Yes, make the elses else if's, and then you will only need one end if also.
ACES WILD is offline   Reply With Quote
Old 05-16-2005, 02:30 PM   #4
Baseband Member
 
Join Date: May 2005
Posts: 21
Default thanks guys

Don't you think I need int, since I have to count numbers of movies a director made
mechboard is offline   Reply With Quote
Old 05-16-2005, 02:51 PM   #5
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,006
Default Re: Sorting in VB

there is a problem...

the second line of your code you clear movie type, but later you check movie type.

you code should start something like

Moviecollection(Movietype, Director)

do if statements.

then shove the movie type and director into an array

ret[1]=movie type
ret[2]=Director

then return the variables

return ret


Your pseudo code assume te use of global variables this is generally a bad paractise.
root is offline   Reply With Quote
Old 05-16-2005, 03:52 PM   #6
Baseband Member
 
Join Date: May 2005
Posts: 21
Default ok

could you give an example?
mechboard is offline   Reply With Quote
Old 05-16-2005, 06:00 PM   #7
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,006
Default Re: Sorting in VB

in what sense? I used your example...
root is offline   Reply With Quote
Old 05-17-2005, 11:42 AM   #8
Baseband Member
 
Join Date: May 2005
Posts: 21
Default Ok

using your movies for example.

anyway thanks for the help I appercaited
__________________

mechboard is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 08:37 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0