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
Photo

VB Help


  • Please log in to reply

#1
Sniperwolf

Sniperwolf

    New Member

  • Member
  • Pip
  • 4 posts
I need to write a program which will in this case work somewhat like a cash register/food order system.

The User needs to be able to input on multiple forms an order (ie: 1 form to handle burgers, 1 to handle pizzas, ect). What im wondering is, would it be possible to take the total from each differant form and carry it over to the last form which would display the total cost of everything that has been entered. If this is possible how would i also enter this code in?

Finally, at the end what kind of code would i have to write for a button that would reset all the saved totals back to zero?
  • 0

Advertisements


#2
computerwiz12890

computerwiz12890

    Fixer-upper guy

  • Retired Staff
  • 1,807 posts
I know how to do this, unfortunately I'm not at my house right now so I can't be as specific as I want to be.

To access info in a different form, you must type the name of that form, add a period, and then type the name of the object you want to access. For example (form1.txthamburger.text)

To clear all info in a form, you can set all info to zero, or you can reload the form. Unfortunately I'm not at my house to get the code for reloading the form, but it's not hard at all.

If you need more help, I'll be here for ya. I'm fairly good with Visual Basic.
  • 0

#3
Sniperwolf

Sniperwolf

    New Member

  • Topic Starter
  • Member
  • Pip
  • 4 posts
if you wouldnt mind posting the code that would be much appreciated
  • 0

#4
dsenette

dsenette

    Je suis Napoléon!

  • Administrator
  • 26,047 posts
  • MVP
this whole project would be made easier and more stable if you had it running ontop of a spreadsheet sysetm...such as excell...or access...or if you used an array within vb....that way the data get's stored before switching forms
  • 0

#5
computerwiz12890

computerwiz12890

    Fixer-upper guy

  • Retired Staff
  • 1,807 posts
Apparently I never got the code to work. It's been a year since I've used VB. I looked back at my best programs, and I don't have a simple code to reset the form. I remember trying to get it to work, but apparently I failed.

You'll have to just set everything back to the way it was if you want to reset it. Sorry I can't help you with that, but if you've got any other questions, I'll try to help you out. :tazz:
  • 0

#6
dsenette

dsenette

    Je suis Napoléon!

  • Administrator
  • 26,047 posts
  • MVP
to clear textboxes..all you should have to do...is put a clear button at the bottom....and set the code for the click action to set each text box equal to ""

txt1.txt = ""
txt2.txt = ""

and so on
  • 0

#7
MaverickSidewinder

MaverickSidewinder

    Member

  • Member
  • PipPipPip
  • 257 posts
If you don't want to make an array just do this:

TheNameOfTheForm!TheTextBoxOfTheFormYouWantToCallItFrom.Text

Example:

Private Sub Command1_Click()
 ' assuming you want to get the text with a command button, if not
 ' you can use this code on the form_load() area

Dim var As String ' var being the text on the other form

var = FormHamburger!Text1.Text ' this gets you the text on the text1 textbox on the formhamburger form

Text2.Text = Str$(var) ' meaning that what was in the FormHamburger!Text1.Text goes in this form's Text2.Text

End Sub

Hope this helped :tazz:
  • 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