Furniture sales coding Visual basic

85 Blood Elf Hunter
4220
Need some help with this... I am having a hard time determining the code

Write a program that allows furniture sales (item and price) to be displayed in a list box one at a time, and then shows the total commission of the sales (6%) upon request (See the figure below). The user should type each item and price into the text boxes and then press the Add and Display Item and Price button. This process can be repeated as many times as desired. At any time the user should be able to press the Show Total Commission button to display the total commission of all the sales that were entered. Note: This program requires a class-level variable.

I have the interface up, perhaps I am just tired, I just can't seem to figure it out right now. Says nothing in my book and can't find any help online so I thought to ask here

Also to keep this warcraft related... How about dem pandas?
Reply Quote
85 Human Mage
5405
First of all, tech forums are that way >>

Second of all, Visual Basic died some time ago. Why are you still using it? C# and .NET are where Windows development is at right now.

Reply Quote
85 Blood Elf Hunter
4220
First of all, tech forums are that way >>

Second of all, Visual Basic died some time ago. Why are you still using it? C# and .NET are where Windows development is at right now.


I don't know, just an assignment. I assumed I would put it in general because wow does not really have any other forums for anything else.
Reply Quote
85 Human Mage
5405
Games, Entertainment, and Technology > Technology and Science is the board you're looking for:

http://us.battle.net/wow/en/forum/2721888/
Reply Quote
85 Blood Elf Hunter
4220
thanks
Reply Quote
90 Undead Hunter
7935
2k gold
Reply Quote
90 Undead Hunter
7935
First of all, tech forums are that way >>

Second of all, Visual Basic died some time ago. Why are you still using it? C# and .NET are where Windows development is at right now.


I don't know, just an assignment. I assumed I would put it in general because wow does not really have any other forums for anything else.


vb and c# are the same in .NET except c# is similar c++.
Reply Quote
85 Blood Elf Hunter
4220
01/30/2012 08:51 PMPosted by Tranhuntard
2k gold


Wish I could lol.
Reply Quote
90 Undead Hunter
7935
what do you mean "class-level variable." Is it a variable in a class?
Reply Quote
85 Blood Elf Hunter
4220
01/30/2012 09:13 PMPosted by Tranhuntard
what do you mean "class-level variable." Is it a variable in a class?


It is so that the variable carries on.

Basically the output would continue on without resetting so that I could add multiple items and have this program add them together and have another button use that same variable to determine the commission.
Reply Quote
90 Undead Hunter
7935
can you list all the control you need?
Reply Quote
85 Blood Elf Hunter
4220
2 text boxes, 1 list box, 2 buttons

1 text box is for item name
the other is price
the list box is to list the item name and price
1 button adds the Item name and price to the listbox
the other button shows the overall commission (6%)

The class level variable is just under public class and it keeps track of the price, making sure it doesn't reset.

also option strict has to be on for some reason.

This is my last problem and it has been giving me a headache for 2 hours now...
Reply Quote
90 Undead Hunter
7935
ok let me try. I haven't written any program in ages, but I think I can do this.
Reply Quote
85 Blood Elf Hunter
4220
01/30/2012 09:33 PMPosted by Tranhuntard
ok let me try. I haven't written any program in ages, but I think I can do this.


Thanks in advance, I have been messing up the code for awhile now and I can't figure out from the book where I am going wrong.
Reply Quote
85 Blood Elf Hunter
4220
Im so close... I just can not get the commission to work properly

It doesnt seem like my class level variable is retaining the numbers
Reply Quote
90 Undead Hunter
7935
namespace Furniture
{
public partial class Form1 : Form
{
protected int totalValue;

public Form1()
{
InitializeComponent();

totalValue = 0;
}

private void btnAdd_Click(object sender, EventArgs e)
{
string name = txtName.Text;
int value = Convert.ToInt32(txtPrice.Text);

if ((name != "") && (value > 0))
{
totalValue += value;
lstNamePrice.Items.Add(name);
}
}

private void btnCommission_Click(object sender, EventArgs e)
{
double commission = Convert.ToDouble(totalValue) * 0.06;

lblCommission.Text = "Commission is: " + commission;
}
}
}

Here you can convert to vb
Reply Quote
90 Undead Hunter
7935
I just found a site to convert for you

Namespace Furniture
Public Partial Class Form1
Inherits Form
Protected totalValue As Integer

Public Sub New()
InitializeComponent()

totalValue = 0
End Sub

Private Sub btnAdd_Click(sender As Object, e As EventArgs)
Dim name As String = txtName.Text
Dim value As Integer = Convert.ToInt32(txtPrice.Text)

If (name <> "") AndAlso (value > 0) Then
totalValue += value
lstNamePrice.Items.Add(name)
End If
End Sub

Private Sub btnCommission_Click(sender As Object, e As EventArgs)
Dim commission As Double = Convert.ToDouble(totalValue) * 0.06

lblCommission.Text = "Commission is: " + commission
End Sub
End Class
End Namespace
Reply Quote
85 Blood Elf Hunter
4220
Thanks a lot, I would have been up all night trying to figure this out.
Reply Quote
90 Undead Hunter
7935
np man
Reply Quote

Please report any Code of Conduct violations, including:

Threats of violence. We take these seriously and will alert the proper authorities.

Posts containing personal information about other players. This includes physical addresses, e-mail addresses, phone numbers, and inappropriate photos and/or videos.

Harassing or discriminatory language. This will not be tolerated.

Forums Code of Conduct

Report Post # written by

Reason
Explain (256 characters max)
Submit Cancel

Reported!

[Close]