I have made an application to add monthly usages of coffee to a listbox using an array. I have a button which opens up an InputBox to enter the monthly usages. I then click a button to display the usages in a listbox. Howerver, I only want users to be able to add numbers to the listbox so when a user clicks enters a non-numeric value or enters nothing at all and clicks OK, a MsgBox appears. I have tried many different ways but none seem to work. Please help!

Public Class frmCostaLot
Dim MonthlyUsages(11) As Single
Private Sub lstUsageAmount_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstUsageAmount.SelectedIndexChanged

End Sub

Private Sub btnEnterUsages_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnterUsages.Click
    Dim usages As Integer
    For usages = 0 To 11
        MonthlyUsages(usages) += InputBox("Please enter a monthly usage value")
    Next
End Sub

Private Sub btnShowUsages_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowUsages.Click
    Dim usages As Integer
    For usages = 0 To 11
        lstUsageAmount.Items.Add(MonthlyUsages(usages))
    Next

End Sub

I am trying to make an array so I can store monthly coffee usages. I have used the code below which puts the monthly usages into a listbox and enables me to store new usages by entering them into a textbox and clicking a button. However, I want the values to store into the application and for them to be present when I re-open the application. I'd like to know if that's possible. Thanks

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMonthlyUsage.Click

    Dim coffeeusage(12) As Double

    coffeeusage(0) = "400.5"
    coffeeusage(1) = "450"
    coffeeusage(2) = "475.5"
    coffeeusage(3) = "336.5"
    coffeeusage(4) = "457"
    coffeeusage(5) = "325"
    coffeeusage(6) = "220.5"
    coffeeusage(7) = "276"
    coffeeusage(8) = "300"
    coffeeusage(9) = "320.5"
    coffeeusage(10) = "400.5"
    coffeeusage(11) = "415"

    lstUsageAmount.Items.Clear()

    Dim i As Double
    For i = 0 To 11
        lstUsageAmount.Items.Add(coffeeusage(i))
    Next i

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNewAmount.Click
Dim newAmount As Double
newAmount = Val(txtNewAmount.Text)

    lstUsageAmount.Items.Add(newAmount)

[QUOTE=thines01;1780193]Do you know anything about storing data in files and retrieving it?
...what about databases?

Either one would do well for your program.

Of course, if it does not need to store data for more than one "session", you could just store the data in arrays.[/QUOTE]

No I don't know anything about storing data files and receiving them. I have heard classmates say they're using arrays but I don't know what they are!

I have been given an assignment where a company requires an application that displays coffee usage information for the managers. I've been given sample data for last years monthly usage amounts in kilos which are: 400.5, 450, 475.5, 336.5, 457, 325, 220.5, 276, 300, 320.5, 400.5 and 415.

I need to create a form which will allow the user to enter and store monthly amounts in an appropriate data structure. The form also has to calculate the total usage for the 12 month period and average monthly usage. A further requirement is for the users to be able to display the monthly totals in ascending and descending order of the monthly usage amounts.

I am sort of a Visual Basic newbie and I would just like ideas on how I would meet these requirements. What to use to displays the results, etc.

Thanks

I have 2 radio buttons on my form which are both different forms of tax. I have a label which has the amount of money i need to multiply the tax by depending on which radio button the user chooses. 1 radio button has tax of 16.5% and the other 11.5% so it means I have to multiply the label by either 1.165 or 1.115 but I havent got a clue on how to code it. Please help

I have a project of 2 forms and on the 2nd form I want to create a button which when clicked, returns you to the 1st form and all values in the 3 textboxes disappear. Please help!

I have a project of 2 forms and on the 2nd form I want to create a button which when clicked returns you to the 1st form. Please help!

[QUOTE=BitBlt;1768574]Use the CHR function to specify special characters like so:
[CODE]Me.Text1.Text = Chr(163) & "2.32"[/CODE]In order to find out what the characters are, just use the Windows Character Map utility, find the character you want, click on it and look in the status bar at the bottom.[/QUOTE]

Thank you that worked! Much appreciated

I have made a currency converter which converts a made up currency to UK Sterling. I have made a converter on my 1st form and on my 2nd form I need to add import duties. There are 2 import duties...

1) Air Cargo: 16.5% of Sterling price
2) Shipping: 11.5% of Sterling price

I need to multiply the the label which shows the amount of UK Sterling on form 2 by either Air Cargo or Shipping depending on which one the user chooses but I have no idea how to code up a combo box as I have never used one before on Visual Basic. Please help!

I have made a currency converter and have converted a made up currency to UK Sterling. I have made it so the amount of UK Sterling appears like '2.32' but I want to have the £ sign before the amount of money to show it is now in UK Sterling. Please help!

Thanks that really helped, it is working now. Much appreciated

I have a created a currency converter in 2 forms in Visual Basic for a made up currency which has pounds shillings and pence. I have 3 textboxes for them to enter the amount of each and a button to calculate the amount of UK Stirling using conversion rates given to me. The amount of UK Stirling is in a label which I then want to have in a second form as I want to show the amount of UK Sterling before I add tax to it. I just don't know how to have the amount showing on the first form to always be portrayed in a label in the second form. Please help!

I'm new to Visual Basic and I am trying to set up a currency converter. I have converted a currency to UK Sterling on the first form and on the second form I want to have the same label with the same amount of UK Sterling as on the first form on the second form. Please help!