Results 1 to 20 of 20

Thread: programming question

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2006
    Posts
    52

    programming question

    I am doing a project--trying to make a sales receipt. I am having problems trying to get the ItemPrice to the Receipt after clicking the button.
    Can anyone help me?

  2. #2
    Frenzied Member ntg's Avatar
    Join Date
    Sep 2004
    Posts
    1,449

    Re: programming question

    I'm sure someone would be willing to help. However, your post is vague and you're not giving any specific code with a specific problem you need help with. I have no idea what's the "ItemPrice" and what's the "button" you're talking about.
    "Feel the force...read the source..."
    Utilities: POPFileDebugViewProcess ExplorerWiresharkKeePassUltraVNCPic2Ascii
    .Net tools & open source: DotNetNukelog4NetCLRProfiler
    My open source projects: Thales SimulatorEFT CalculatorSystem Info ReporterVSS2SVNIBAN Functions
    Customer quote: "If the server has a RAID array, why should we bother with backups?"
    Programmer quote: "I never comment my code. Something that is hard to write should be impossible to comprehend."
    Ignorant quote: "I have no respect for universities, as they teach not practicle stuff, and charge money for"

  3. #3
    Hyperactive Member Mosabama's Avatar
    Join Date
    Aug 2004
    Location
    Mars
    Posts
    306

    Re: programming question

    Ehat do you mean Receipt ?? Do you mean Crystal report or something ?
    do you want to the item price to be in the report ?? what do you mean ?
    My software never has bugs. It just develops random features.
    I RATE, YOU RATE!!!

  4. #4

    Thread Starter
    Member
    Join Date
    Jan 2006
    Posts
    52

    Re: programming question

    When you enter in a Item Price in the first text box, Like say the Item was $10.00.
    I need that $10.00 (which that text box is called ItemPriceText) after clicking the button(button1) to go over to the Sales Receipt (SalesReceiptLabel)

  5. #5
    Frenzied Member ntg's Avatar
    Join Date
    Sep 2004
    Posts
    1,449

    Re: programming question

    If I understand correctly:
    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         SalesReceiptLabel.Text = ItemPriceText.Text
    3.     End Sub
    "Feel the force...read the source..."
    Utilities: POPFileDebugViewProcess ExplorerWiresharkKeePassUltraVNCPic2Ascii
    .Net tools & open source: DotNetNukelog4NetCLRProfiler
    My open source projects: Thales SimulatorEFT CalculatorSystem Info ReporterVSS2SVNIBAN Functions
    Customer quote: "If the server has a RAID array, why should we bother with backups?"
    Programmer quote: "I never comment my code. Something that is hard to write should be impossible to comprehend."
    Ignorant quote: "I have no respect for universities, as they teach not practicle stuff, and charge money for"

  6. #6

    Thread Starter
    Member
    Join Date
    Jan 2006
    Posts
    52

    Re: programming question

    I tried doing that but it said that SalesRecieptLabel is not declared

  7. #7
    Frenzied Member ntg's Avatar
    Join Date
    Sep 2004
    Posts
    1,449

    Re: programming question

    You said that the label is called "SalesReceiptLabel". Please post your code so far so we can see what the problem is.
    "Feel the force...read the source..."
    Utilities: POPFileDebugViewProcess ExplorerWiresharkKeePassUltraVNCPic2Ascii
    .Net tools & open source: DotNetNukelog4NetCLRProfiler
    My open source projects: Thales SimulatorEFT CalculatorSystem Info ReporterVSS2SVNIBAN Functions
    Customer quote: "If the server has a RAID array, why should we bother with backups?"
    Programmer quote: "I never comment my code. Something that is hard to write should be impossible to comprehend."
    Ignorant quote: "I have no respect for universities, as they teach not practicle stuff, and charge money for"

  8. #8

    Thread Starter
    Member
    Join Date
    Jan 2006
    Posts
    52

    Re: programming question

    ublic Class Form1
    Inherits System.Windows.Forms.Form

    #Region " Windows Form Designer generated code "

    Public Sub New()
    MyBase.New()

    'This call is required by the Windows Form Designer.
    InitializeComponent()

    'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
    If disposing Then
    If Not (components Is Nothing) Then
    components.Dispose()
    End If
    End If
    MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents ItemPrice As System.Windows.Forms.Label
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents ReceiptLabel As System.Windows.Forms.Label
    Friend WithEvents ItemPriceText As System.Windows.Forms.TextBox
    Friend WithEvents SubTotalText As System.Windows.Forms.TextBox
    Friend WithEvents SalesTaxText As System.Windows.Forms.TextBox
    Friend WithEvents TotalText As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    Me.ItemPrice = New System.Windows.Forms.Label
    Me.Button1 = New System.Windows.Forms.Button
    Me.Label3 = New System.Windows.Forms.Label
    Me.Button2 = New System.Windows.Forms.Button
    Me.Label1 = New System.Windows.Forms.Label
    Me.Label2 = New System.Windows.Forms.Label
    Me.Label4 = New System.Windows.Forms.Label
    Me.ReceiptLabel = New System.Windows.Forms.Label
    Me.ItemPriceText = New System.Windows.Forms.TextBox
    Me.SubTotalText = New System.Windows.Forms.TextBox
    Me.SalesTaxText = New System.Windows.Forms.TextBox
    Me.TotalText = New System.Windows.Forms.TextBox
    Me.SuspendLayout()
    '
    'ItemPrice
    '
    Me.ItemPrice.Location = New System.Drawing.Point(8, 24)
    Me.ItemPrice.Name = "ItemPrice"
    Me.ItemPrice.Size = New System.Drawing.Size(72, 16)
    Me.ItemPrice.TabIndex = 0
    Me.ItemPrice.Text = "Item Price"
    Me.ItemPrice.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
    '
    'Button1
    '
    Me.Button1.Location = New System.Drawing.Point(8, 72)
    Me.Button1.Name = "Button1"
    Me.Button1.Size = New System.Drawing.Size(88, 24)
    Me.Button1.TabIndex = 2
    Me.Button1.Text = "Add to Receipt"
    '
    'Label3
    '
    Me.Label3.Location = New System.Drawing.Point(112, 24)
    Me.Label3.Name = "Label3"
    Me.Label3.Size = New System.Drawing.Size(96, 16)
    Me.Label3.TabIndex = 3
    Me.Label3.Text = "Sales Receipt"
    Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
    '
    'Button2
    '
    Me.Button2.Location = New System.Drawing.Point(232, 232)
    Me.Button2.Name = "Button2"
    Me.Button2.Size = New System.Drawing.Size(56, 32)
    Me.Button2.TabIndex = 8
    Me.Button2.Text = "E&xit"
    '
    'Label1
    '
    Me.Label1.Location = New System.Drawing.Point(184, 176)
    Me.Label1.Name = "Label1"
    Me.Label1.Size = New System.Drawing.Size(64, 16)
    Me.Label1.TabIndex = 9
    Me.Label1.Text = "Sub Total"
    '
    'Label2
    '
    Me.Label2.Location = New System.Drawing.Point(184, 208)
    Me.Label2.Name = "Label2"
    Me.Label2.Size = New System.Drawing.Size(56, 16)
    Me.Label2.TabIndex = 10
    Me.Label2.Text = "Sales Tax"
    '
    'Label4
    '
    Me.Label4.Location = New System.Drawing.Point(184, 240)
    Me.Label4.Name = "Label4"
    Me.Label4.Size = New System.Drawing.Size(40, 16)
    Me.Label4.TabIndex = 11
    Me.Label4.Text = "Total"
    '
    'ReceiptLabel
    '
    Me.ReceiptLabel.BackColor = System.Drawing.SystemColors.ControlLightLight
    Me.ReceiptLabel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
    Me.ReceiptLabel.ForeColor = System.Drawing.SystemColors.ControlDarkDark
    Me.ReceiptLabel.Location = New System.Drawing.Point(104, 40)
    Me.ReceiptLabel.Name = "ReceiptLabel"
    Me.ReceiptLabel.Size = New System.Drawing.Size(128, 96)
    Me.ReceiptLabel.TabIndex = 4
    '
    'ItemPriceText
    '
    Me.ItemPriceText.Location = New System.Drawing.Point(8, 40)
    Me.ItemPriceText.Name = "ItemPriceText"
    Me.ItemPriceText.Size = New System.Drawing.Size(80, 20)
    Me.ItemPriceText.TabIndex = 12
    Me.ItemPriceText.Text = ""
    '
    'SubTotalText
    '
    Me.SubTotalText.BackColor = System.Drawing.SystemColors.InactiveBorder
    Me.SubTotalText.Location = New System.Drawing.Point(104, 168)
    Me.SubTotalText.Name = "SubTotalText"
    Me.SubTotalText.Size = New System.Drawing.Size(80, 20)
    Me.SubTotalText.TabIndex = 13
    Me.SubTotalText.Text = ""
    '
    'SalesTaxText
    '
    Me.SalesTaxText.BackColor = System.Drawing.SystemColors.InactiveBorder
    Me.SalesTaxText.Location = New System.Drawing.Point(104, 200)
    Me.SalesTaxText.Name = "SalesTaxText"
    Me.SalesTaxText.Size = New System.Drawing.Size(80, 20)
    Me.SalesTaxText.TabIndex = 14
    Me.SalesTaxText.Text = ""
    '
    'TotalText
    '
    Me.TotalText.BackColor = System.Drawing.SystemColors.InactiveBorder
    Me.TotalText.Location = New System.Drawing.Point(104, 232)
    Me.TotalText.Name = "TotalText"
    Me.TotalText.Size = New System.Drawing.Size(80, 20)
    Me.TotalText.TabIndex = 15
    Me.TotalText.Text = ""
    '
    'Form1
    '
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    Me.ClientSize = New System.Drawing.Size(292, 273)
    Me.Controls.Add(Me.TotalText)
    Me.Controls.Add(Me.SalesTaxText)
    Me.Controls.Add(Me.SubTotalText)
    Me.Controls.Add(Me.ItemPriceText)
    Me.Controls.Add(Me.Label4)
    Me.Controls.Add(Me.Label2)
    Me.Controls.Add(Me.Label1)
    Me.Controls.Add(Me.Button2)
    Me.Controls.Add(Me.ReceiptLabel)
    Me.Controls.Add(Me.Label3)
    Me.Controls.Add(Me.Button1)
    Me.Controls.Add(Me.ItemPrice)
    Me.Name = "Form1"
    Me.Text = "Form1"
    Me.ResumeLayout(False)

    End Sub

    #End Region

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub ItemPrice_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ItemPrice.Click

    End Sub

    Private Sub ItmPrLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub ReceiptLabel_ChangeUICues(ByVal sender As Object, ByVal e As System.Windows.Forms.UICuesEventArgs) Handles ReceiptLabel.ChangeUICues

    End Sub

    Private Sub ReceiptLabel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ReceiptLabel.Click

    End Sub

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    SalesReceiptLabel.Text = ItemPriceText.Text





    End Sub

    Private Sub ItemPriceText_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ItemPriceText.Click
    Dim ItemPriceText As Single
    ItemPriceText = FormatCurrency(ItemPriceText)



    End Sub
    End Class

  9. #9

    Thread Starter
    Member
    Join Date
    Jan 2006
    Posts
    52

    Re: programming question

    I'm very new to this as you can tell. Would it be easier for me to send it to you, so you can see how it works thus far?

  10. #10
    Frenzied Member ntg's Avatar
    Join Date
    Sep 2004
    Posts
    1,449

    Re: programming question

    The label is called ReceiptLabel. Try:

    VB Code:
    1. Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         ReceiptLabel.Text = ItemPriceText.Text
    3.     End Sub
    "Feel the force...read the source..."
    Utilities: POPFileDebugViewProcess ExplorerWiresharkKeePassUltraVNCPic2Ascii
    .Net tools & open source: DotNetNukelog4NetCLRProfiler
    My open source projects: Thales SimulatorEFT CalculatorSystem Info ReporterVSS2SVNIBAN Functions
    Customer quote: "If the server has a RAID array, why should we bother with backups?"
    Programmer quote: "I never comment my code. Something that is hard to write should be impossible to comprehend."
    Ignorant quote: "I have no respect for universities, as they teach not practicle stuff, and charge money for"

  11. #11

    Thread Starter
    Member
    Join Date
    Jan 2006
    Posts
    52

    Re: programming question

    After I get that $10.00 (from the ItemPriceText) to the SalesReceiptLabel, I have to add $9.99 to the ReceiptLabel as well.

  12. #12
    Frenzied Member ntg's Avatar
    Join Date
    Sep 2004
    Posts
    1,449

    Re: programming question

    Quote Originally Posted by Oneworkngrl
    I'm very new to this as you can tell.
    No problem, that's what the forum is for. If possible, try wrapping code with the VBCode tags (there is a VBCode button on the message window when you create a post).
    "Feel the force...read the source..."
    Utilities: POPFileDebugViewProcess ExplorerWiresharkKeePassUltraVNCPic2Ascii
    .Net tools & open source: DotNetNukelog4NetCLRProfiler
    My open source projects: Thales SimulatorEFT CalculatorSystem Info ReporterVSS2SVNIBAN Functions
    Customer quote: "If the server has a RAID array, why should we bother with backups?"
    Programmer quote: "I never comment my code. Something that is hard to write should be impossible to comprehend."
    Ignorant quote: "I have no respect for universities, as they teach not practicle stuff, and charge money for"

  13. #13

    Thread Starter
    Member
    Join Date
    Jan 2006
    Posts
    52

    Re: programming question

    Thank you very much!!! I can't tell how how much this has been bugging me!

  14. #14

    Thread Starter
    Member
    Join Date
    Jan 2006
    Posts
    52

    Re: programming question

    To add to the Receipt do I use:

    ReceiptLabel.Items.Add(ItemPriceText)?

  15. #15
    Frenzied Member ntg's Avatar
    Join Date
    Sep 2004
    Posts
    1,449

    Re: programming question

    I'm guessing that you need ReceiptLabel to hold a list of items. You're using a Label control (so .Items.Add is inapplicable - for this you would need something like a ListBox). However, you can get to what you need by using:

    VB Code:
    1. Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         ReceiptLabel.Text += "$" + ItemPriceText.Text + vbCrLf
    3.     End Sub
    I assume that you'll want to calculate totals also. For this, you should first set the SubTotalText textbox to 0 in your form's load event:

    VB Code:
    1. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.         SubTotalText.Text = "0.00"
    3.     End Sub

    Then, as items are added you should add code to your button handler (the Button1_Click sub you have in the code) in order to do the addition. You should try to convert the text entered in the ItemPriceText textbox to a double number (use Convert.ToDouble for that) - then do the same to the text in SubTotalText textbox and add them both together. Finally, convert the result to text (use Convert.ToString) and enter the new value in the SubTotalText textbox.
    "Feel the force...read the source..."
    Utilities: POPFileDebugViewProcess ExplorerWiresharkKeePassUltraVNCPic2Ascii
    .Net tools & open source: DotNetNukelog4NetCLRProfiler
    My open source projects: Thales SimulatorEFT CalculatorSystem Info ReporterVSS2SVNIBAN Functions
    Customer quote: "If the server has a RAID array, why should we bother with backups?"
    Programmer quote: "I never comment my code. Something that is hard to write should be impossible to comprehend."
    Ignorant quote: "I have no respect for universities, as they teach not practicle stuff, and charge money for"

  16. #16

    Thread Starter
    Member
    Join Date
    Jan 2006
    Posts
    52

    Re: programming question

    Oh my goodness! I am so grateful to you!

  17. #17

    Thread Starter
    Member
    Join Date
    Jan 2006
    Posts
    52

    Re: programming question

    I have been stuck on this for like days!

  18. #18
    Fanatic Member jcavard's Avatar
    Join Date
    Jul 2005
    Location
    Quebec, CANADA
    Posts
    534

    Re: programming question

    Hey oneworkngrl, I can't help you, but it's cool to see a girl programmer. I'm sure yo sexy as hell. good luck!
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

    accoustic emo-rock band: a tailormade fable

    Visual Studio 2003 / Framework 1.1

  19. #19

    Thread Starter
    Member
    Join Date
    Jan 2006
    Posts
    52

    Re: programming question

    LOL....Thanks

  20. #20

    Thread Starter
    Member
    Join Date
    Jan 2006
    Posts
    52

    Re: programming question

    Ok....Now I got another question--I can't get the Receipt Label to add additional numbers from the ItemPriceText.

    Oh, boy! Am I having frustrating day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width