November 20th, 2002, 08:54 PM
|
#1 (permalink)
| | Member
Join Date: Sep 2002 Location: Shirley, New York
Posts: 256
| Should be A simple for all your VB People out there
Ok I have 2 picture boxes... One contains a list from a file.. the other when the run box is click has to take from a Text Box the item and search for it in the file and print it out in the other picture box..
Ex.
Picture Box #1 will contain the items searched
Picture Box #2 contains items from file.
Txt box = coffee
Picture box 1 - Displays Coffee $4.95
If any one knows how i can do this... please get back to me ASAP.. my project is due 2-morrow.. Thank you
to download the project www.pjcassociates.com/assignment5.zip
THANK YOU!!!!! |
| |
November 20th, 2002, 10:25 PM
|
#2 (permalink)
| | Member
Join Date: Sep 2002 Location: Shirley, New York
Posts: 256
|
Ok maybe this may help some more.... The directions from my professor says
This part has two part to it, and uses two picture boxes. Construct and run a program that lets user find the price of something in stock. The items in stock are contained in a file created using NotePad. The user enters an item in the textbox, for which a price is wanted, then clicks the "Find Price" button. If the item is found (i.e., is in the file, it outputs to the picturebox the item and its price. If the item is not in the file, program outputs the item requested and "Not in stock". As a tool, the contents of the file can be viewed by clicking the button "Show File Contents".
Ok I don't know if that helps.. but if it does great.. Thanks Again for the help... I'm really puzzled. |
| |
November 20th, 2002, 11:30 PM
|
#3 (permalink)
| | Member
Join Date: Sep 2002 Location: Shirley, New York
Posts: 256
|
I guess i'm gonna be a loner on this one  If someone knows how to do this, please help i'm in a bind... Alright.. I'm going back to trying this again. |
| |
November 21st, 2002, 03:04 AM
|
#4 (permalink)
| | Member
Join Date: Sep 2002 Location: Shirley, New York
Posts: 256
|
ok Maybe i should have made the subject a challenge for VB users. hehehe |
| |
November 28th, 2002, 05:48 PM
|
#5 (permalink)
| | Ultimate Member
Join Date: Oct 2001
Posts: 21,019
| Code: Private Sub cmdguess_Click()
Dim Secret As Integer, Guessed As Integer, Count As Integer
PicGuess.Cls
' you have an infinite loop of hell in here with this input box!
Secret = Val(InputBox("Enter Number to be Guessed", "Secret Number"))
Count = 0
Do While Secret <> Guessed
Guessed = Val(InputBox("Enter Your Guess", "Guess"))
If Secret = Guessed Then
PicGuess.Print "Done, it took you"; Count + 1; "tries, to guess"; Secret;
ElseIf Secret > Guessed Then
Count = Count + 1
PicGuess.Print Count; Tab(10); Guessed; Tab(20); "Larger"
ElseIf Secret < Guessed Then
Count = Count + 1
PicGuess.Print Count; Tab(10); Guessed; Tab(20); "Smaller"
Else
PicGuess.Print ""
End If
Loop
End Sub
Private Sub cmdprice_Click()
Dim Items As String, Cost As String
' Loop through the file, and check if the "Items" = the value in the text box ' Use UCase to make both sides upper case so the text is ' insensitive to what case is input
Open "D:\Temp\items.txt" For Input As #1
Do Until EOF(1)
Input #1, Items, Cost
If UCase(Items) = UCase(txtitems.Text) Then
PicPrice.Print Items, Cost
End If
Loop
' Close the file at the end or you'll get an error ' that the file is already open everytime you hit the button
Close #1
End Sub
Private Sub cmdshow_Click()
Dim Items As String, Cost As String
' clear the picture box to reset it everytime ' or it will simply scroll off the bottom and not be viewable
PicFile.Cls
Open "D:\Temp\items.txt" For Input As #1
Do Until EOF(1)
Input #1, Items, Cost
PicFile.Print Items, Cost
Loop
Close #1
End Sub We generally don't like to help solve a persons homework, but I'm guessing this was due awhile ago
I made comments in red.
It drives me INSANE that teachers are using a STUPID picture box to view text 
POOOOOOOOOOOOOOR habit to get into as its NOT meant to view text!!!
arghhhhh
idiots  lol
(I'm meaning that towards the people who write this stuff, not you the student... actually there was another person I helped with vb when she was taking classes and they used picture boxes as well  )
Last edited by vass0922 : November 28th, 2002 at 05:51 PM.
|
| |
November 28th, 2002, 08:06 PM
|
#6 (permalink)
| | Member
Join Date: Sep 2002 Location: Shirley, New York
Posts: 256
|
Thank you appreciate your help with this... my instructor does not know how to explain things... I had to go out and buy a different Visual Basic book just to help me with this class. Thanks again for the help. |
| | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | |
Posting Rules
| You may post new threads You may post replies You may not post attachments You may not edit your posts HTML code is Off | | | | Most Active Discussions | | | | | Recent Discussions  | | | | | |