2 Replies - 414 Views - Last Post: 08 October 2012 - 09:20 AM Rate Topic: -----

#1 lledo3  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 28-February 11

VB Form Issue

Posted 03 October 2012 - 07:24 AM

So I have everything working except I am not sure how program the "invoice ID" and "First" and "Last". Some help would be greatly appreciated. I have attached a picture of what form should look like and here is the code I've done.

 Private Sub btn_processOrder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_processOrder.Click
        Dim chairs, desks, cost, salesTax, totalCost As Double
        Dim fullname, address, residence, first, last, invoice As String
        fullname = txt_Name.Text
        address = txt_Address.Text
        residence = txt_Residence.Text
        chairs = CInt(txt_chairsOrdered.Text)
        desks = CInt(txt_desksOrdered.Text)
        cost = (chairs * 320) + (desks * 950)
        salesTax = cost * 0.07
        totalCost = salesTax + cost


        ListBox1.Items.Add("Invoice Number: " & invoice)
        ListBox1.Items.Add("")
        ListBox1.Items.Add("Name: " & first & " " & last)
        ListBox1.Items.Add("Address: " & address)
        ListBox1.Items.Add("City: " & residence)
        ListBox1.Items.Add("")
        ListBox1.Items.Add("Number of Chairs: " & chairs)
        ListBox1.Items.Add("Number of Desks: " & desks)
        ListBox1.Items.Add("")
        ListBox1.Items.Add("      Cost:      " & FormatCurrency(cost))
        ListBox1.Items.Add(" Sales Tax:    " & FormatCurrency(salesTax))
        ListBox1.Items.Add("                           -------------")
        ListBox1.Items.Add("Total Cost: " & FormatCurrency(totalCost))
    End Sub
    Private Sub processOrder(ByVal fullname() As String, ByRef last As String, ByRef first As String, ByVal residence As String, ByRef invoice As String)



    End Sub

    Private Sub btn_clearOderForm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_clearOderForm.Click
        txt_Name.Text = " "
        txt_Address.Text = " "
        txt_Residence.Text = " "
        txt_chairsOrdered.Text = " "
        txt_desksOrdered.Text = " "
        ListBox1.Items.Clear()
    End Sub

    Private Sub btn_quit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_quit.Click
        Me.Close()
    End Sub


Is This A Good Question/Topic? 0
  • +

Replies To: VB Form Issue

#2 lar3ry  Icon User is offline

  • Coding Geezer
  • member icon

Reputation: 310
  • View blog
  • Posts: 1,290
  • Joined: 12-September 12

Re: VB Form Issue

Posted 08 October 2012 - 09:08 AM

View Postlledo3, on 03 October 2012 - 07:24 AM, said:

So I have everything working except I am not sure how program the "invoice ID" and "First" and "Last". Some help would be greatly appreciated. I have attached a picture of what form should look like and here is the code I've done.


You didn't attach a picture file, but I think I know what you are asking.
I assume the txt_ variables are TextBoxes.

First, the Invoice ID, since it is not entered by the customer, has to be supplied by your program. You will have to keep track of numbers already used, and generate a new one for each order. You can do this with a file or with My.Settings, and perhaps other methods. These two are the simplest.

As for first and last names, it would be best to have two input fields, one for first and one for last name. This gets rid of any ambiguity when entering.

"What's your name sir?"
"Bond, James Bond."

or better...

"Last name, sir?"
"Bond"
"First name?"
"James."

This post has been edited by lar3ry: 08 October 2012 - 09:08 AM

Was This Post Helpful? 0
  • +
  • -

#3 trevster344  Icon User is offline

  • The Peasant
  • member icon

Reputation: 224
  • View blog
  • Posts: 1,501
  • Joined: 16-March 11

Re: VB Form Issue

Posted 08 October 2012 - 09:20 AM

What have you tried in relations to your issue? What error did you get in relations to your issue? We can't write code for you.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1