Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




VB Exercise


Could anyone give me a VB exercise that i could do. Something to exercise my skills. Please Anyone




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Help With Exercise Pls
Write an application that stores the names of your five favorite friends, their ages, and their phone numbers in five records in a disk file. Use Write # to write each three-value record and Input # to read each record. Call the data-entry and file-writing procedures from one procedure and the file-reading and display procedure from another procedure.

The code is this:

Public Sub WriteValues()
Open "c:friends.dat" For Output As #1
Write #1, "George", 35, "912-3344"
Write #1, "Elaine", 31, "649-1999"
Write #1, "Jerry", 34, "912-5712"
Write #1, "Kramer", 38, "747-1123"
Write #1, "Newman", 32, "648-2900"
Close #1
End Sub

Public Sub ReadValues()
Dim strName(6) As String
Dim intAge(6) As Integer
Dim strPhone(6) As String
Open "c:friends.dat" For Input As #1
For intCtr = 1 to 5
Input #1, strName(intCtr), intAge(intCtr), strPhone(intCtr)
Next intCtr
Close #1
'Code goes here that processes data
End Sub

Somebody please tell me exactly what controls and how many to put on the form, and how to associate the controls to the code; also, if the above code is insufficient, pls help me complete it. Thanks!!

Exercise 3
Sir/Maam
I am trying to complete the following exercise.(see Attached) I am having difficulting understanding how to develop or set the program up using a .dat file. How do I create a .dat file in order to use it with the visual basic program in the exercise attached. Your assistance will be greatly appreciated.

In thid exercise you will open, read, write, close and print a sequential file.

Scenario: Boggs Inc. wants an application that will allow the user to enter the inventory
number, quantity, and price of each item in the inventory. The application should allow the user to record
this information in a sequential access file named la3.dat in Tut 06 on your student disk. In addition, the application
should allow the user to print a report showing the inventory number, quantity, and price of each inventory
item, as well as the average price. (Hint: To calculate the average price, multiply each item's quantity by its price;
add these amounts together, then divide that sum by the total quantity of all the items in inventory.)

a. Create an appropriate interface.
b. Save the form and then project as la3Done in the Tut06 folder on your student disk.
c. Code the application appropriately, then save and run the application. Test the application by entering and saving
the following records:

Inventory Number Quantity Item Price
    ABC12 100 10.50
    XYZ35 50 15.99
    KLK25 150 20.00

d. print the report
e. Stop the application, then run the application. Enter and save the following records,
which should be added to the records already in the file.

Inventory Number Quantity Item Price
    WER10 110 5.53
    JAN24 20         4.46

f. Print the report
g. Stop the application, then print the code
h. Submit the prints from steps d and f, and the code from step g.

V/R
Tony

Am I ****t For My Exercise? :whoops:
im making a project for school
and now i just noticed something
i made a setup
and now i installed the program on my pc
but if i start it it says something about "cant find the database", but the database is on the server...
i need to install the program on 5 diffrent pc's and theiy have to work with one database but theiy dont know where the database is, how can i let the program know where the database is?


and if someone is already using the datbase, how do i prevent my project from crashing?


why didnt anyone tell me that at school i hope it is not to late

Morning Exercise
Good Morning,

Right now in My Country,South Africa,it is 09:46 morning.Guys I want advice on what must I do to avoid the case that everytime when there is a Message to be displayed by my code,the form that will be currently viewed,it disappers and when I click OK on my Message my form comes onto the Picture,Why it hides itself ?

Please Help Bras........

Thanx In advance.

VB6.0 Lab Exercise Question..
I was just doing an exercise from the lab.

But, i got..dam stuck. Just wondering..if u guyz could help me out.

This is what i gotta do: I have to create 2 identical forms. Identical in terms of layout and Code. So, that they can be run at the same time.

If you see the layout of the form (Bottom). There is Time and date textboxes. ANd there is a horizontal slider to update time in terms of seconds. so, we can select the updatin manually upon sliding.

And the last box, pretty much tells how long the forms have been running or windows have been opened.

On one of the forms, there is a button called, Show form2/Hideform2 to, show or hide the other form.

EXERCISE

1) One of the Two command buttons on each of the forms for showing and hiding the alternate form is deleted.

2) Use a slider control to adjust the value to a text box used for setting the interval.

3) Ensure that the interval limits are 0 to 20 seconds.

4) Add a text box and label to each form indicating how many seconds have elapsed since the window was opened. When you close the window and reopen it, the time should restart from 0 seconds.

The 2 forms should look like the following:

http://img399.imageshack.us/my.php?i...mage0027jk.jpg

--------------------------------------------------------------------

Well, the thing is I got stuck at #4 from above. The textbox is not showing the time elapsed, the windows stayed open..

Neways here is my code:

Code:
Private Sub cmdClear_Click()
txtDate.Text = ""
txtTime.Text = ""
MsgBox ("Date and time have been cleared")
End Sub

Private Sub Command_Interval_Click()
Timer1.Interval = (Val(IntervalTime.Text) * 1000)
End Sub

Private Sub Command1_Click()
If Command1.Caption = "ShowForm2Lab3" Then
Frm2Lab3.Show 0
Command1.Caption = "HideForm2Lab3"
ElseIf Command1.Caption = "HideForm2Lab3" Then
Frm2Lab3.Hide
Command1.Caption = "ShowForm2Lab3"
End If

End Sub

Private Sub Form_Load()

End Sub

Private Sub HScroll1_Change()
IntervalTime.Text = HScroll1.Value
End Sub

Private Sub IntervalTime_Change()
Dim result As Integer
result = Val(IntervalTime.Text)
End Sub


Private Sub Text1_Change()

End Sub

Private Sub TimeElapsed_Change()

TimeElapsed.Text = Time() /comments: i am stuck here..this one not working
End Sub

Private Sub Timer1_Timer()
GetTimeData
txtTime.Text = TimeVariable
txtDate.Text = DateVariable

End Sub
I am also attaching the Form that i was working..on..

your help is much appreciated!
thanks
dino.

Loop Exercise
Could anyone give me a lot of looping problem. Anything that would be my additional practice of loopings

Porting Exercise
Hi Folks,
I have been asked to port a vb 5.0 application to a vb 6.0. I need to know what do I need to do for this. AFAIK, you just need to open the project files into VB 6 and save them. Is this approach ok? Will everything work fine? Are there any tools available for this?

Cheers,
Abhijit

I Need To Do 2 Simple Exercise Please Help
hi all please help me i need to create 2 program and i need to know what to write in the code area

1. writing program that get number with 3 numbers and return the result of the multiply of the 3 numbers

2. writing program that get number with 4 numbers and return
the number from the end to start ( i mean if i give 1234 i need in the end the result to be 4321)

please i need it with full code area

thanks

Typing Exercise
I am working on a typing exercise. What I want to do is that, when the user type the right word, the color of that character will change, but how can I do this?

thanks for help.

Help With Simple Exercise
Write a program that stores the 256 ASCII characters (from ASCII 0 to ASCII 255) in a string array that's defined to hold 256 characters.

The code to this exercise is the ff:
Dim strASCII(256) as String
For intCtr = 0 to 255
strASCII(intCtr) = Chr(intCtr) 'Chr is visual basic's built-in function
Next intCtr

I don't know if this code is correct or complete, please add codes to it if it is insufficient.
Also, what should the form look like? How many command buttons, textboxes, labels, etc. ....help me make a complete executable program based on this exercise. thanks guys!!

Difficult Loop Exercise (I Think)
It has been a while for me that I've used VB, but so from work ask me to write a little program in VB to do the following:

You have a DB with one table with two fields Number and Result. What needs to happen is... Take f.e. the numbers 10, 10, 20, 20, 20, 20, 23, 24, 20, 20, 20. Take the first number. If the consecutive number is the same, then the first number receives as result 'first', the other one 'last'. If more then two consecutive numbers are the same, then the first numbers receives 'first', the last one 'last' and the ones in between receive 'in between'.

So for the example given it should be first, last, first, in between, in between, last, first, first, first, in between, last.

Do you guys get it?

Now, it's too long ago for me. I gave it a try this afternoon, but didn't succeeded at all.

Is there someone so kind to help me out? Thx!

Simple School Exercise (Project) Help
I'm really new to Visual Basic. I'm in an introductory class and have to do different exercises. I need this one for a good grade. Here's the exercise explanation:

"Create a Hidden Prizes application that contains a control array of command buttons to represent a 5 x 5 board. The user is allowed five guesses to find the two randomly selected command buttons that contain the text "Comp" and "uter". If the user finds both of the hidden words, he or she wins."

Any help would be helpful. I'm having trouble with predetermining the command buttons with a either a "Comp", "uter", or "X". I've got two different random numbers for "Comp" and "uter" but I probably did that wrong. After 5 attempts a message box pops up but I think I got that. Just keep it simple if you can. Thanks!

Copyright 2005-08 www.BigResource.com, All rights reserved