Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works

Visual Basic 6.0 Help please

  • Please log in to reply




  • Member
  • PipPip
  • 21 posts
Hey all, I'm new here, not sure if this is the right place to post this, but here goes. ;)

I need some help in Microsoft Visual Basics 6.0. Here is my layout so far.

Posted Image

Note: txtFirstType, txtFirstAmount, txtSecondType, txtSecondAmount and txtName are the names that I assigned to the respective text boxes.

Here is my program for my "Receipt Button" (circled in red in the picture)

Dim iChocolate As Integer
Dim iVanilla As Integer
Dim iMint As Integer
Dim iBeforeTax As Integer
Option Explicit

Private Sub cmdReceipt_Click()

If txtFirstType.Text = "C" Then
iChocolate = Val(txtFirstAmount.Text)
ElseIf txtFirstType.Text = "V" Then
iVanilla = Val(txtFirstAmount.Text)
ElseIf txtFirstType.Text = "M" Then
iMint = Val(txtFirstAmount.Text)
End If

If txtSecondType.Text = "C" Then
iChocolate = Val(txtSecondAmount.Text)
ElseIf txtSecondType.Text = "V" Then
iVanilla = Val(txtSecondAmount.Text)
ElseIf txtSecondType.Text = "M" Then
iMint = Val(txtSecondAmount.Text)
End If

lblOutput.Caption = "Customer's Name : " & txtName.Text _
& vbNewLine _
& "Chocolate Cookies = " & "iChocolate" _
& vbNewLine _
& "Vanilla Cookies = " & "iVanilla" _
& vbNewLine _
& "Mint Cookies = " & "iMint" _
& vbNewLine _
& "Subtotal = " & iChocolate * 5.99 + iVanilla * 5.49 + iMint * 6.49 _
& vbNewLine _
& iBeforeTax = iChocolate * 5.99 + iVanilla * 5.49 + iMint * 6.49 _
& "PST For Order = " & iBeforeTax * 0.08 _
& vbNewLine _
& "GST For Order = " & iBeforeTax * 0.07 _
& vbNewLine _
& "Grand Total = " & iBeforeTax * 1.15
End Sub

Now the problem is that after I run my visual basics program, no matter what input I enter in the text boxes, my lblOutput textbox is always False. The only thing it shows is the word False after I click on the Recipt Button. What I'm trying to do is make something like the following appear in the Output label:

Customer's Name : James
Chocolate Cookies = 5
Vanilla Cookies = 7
Mint Cookies = 4

Thanks for any help! :tazz:
  • 0





  • Topic Starter
  • Member
  • PipPip
  • 21 posts
nvm got it
  • 0



    New Member

  • Member
  • Pip
  • 1 posts
Would anyone (in relation to this program) know how to do the following:
(Located At: http://www.utsc.utor...w05/a2/a2.html)

Encode/Decode Button
Implementation of the Encode/Decode button is worth 1 mark out of 10 on this assignment. Please note that this is only one button that has either the word "Encode" or "Decode" displayed on it at any given time.

You do not need to do any error checking at all for this button. You can write your code assuming that whenever the Encode/Decode button is pressed, the customer name text box will always contain a name that is at least three characters long.

The Encode/Decode command button doesn't have any useful purpose other than to give you practice with using string functions and using a loop (since you MUST use a loop to go through characters in the name, one character at a time, to reverse the characters). Initially this button will have the word Encode written on it. When the user presses the Encode button, it encodes the name that is currently in the customer name text box by reversering the order of the last three characters in the customer name text box.

Once the Encode command button is clicked, the name that was in the customer name text box is replaced by this new encoded name, and the text showing on the command button is changed so that the command button now displays the word Decode. By pressing the Decode button, the name in the text box should change back to its original form, and the word showing on this command button should change to Encode. You can continually click on the Encode and Decode buttons to change the name back and forth between encoded and decoded form. The focus stays on this button when pressed.

For example, if the name "Jane Smith" was in the name text box and the user clicked on Encode, the name in this text box would change to "Jane Smhti" and the button would change to Decode.
  • 0

Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP