listbox questions

bjornb

New member
Joined
May 30, 2003
Messages
2
Hello there,

Im really a beginning programmer i have the following question.
i have to make an visual program for school.
the program is called allens woodshop.

I have a listbox filled with a textdocument.
When something in the listbox is checked, there is an option to choose in an numericupdownbox to choose how many woods you want to order, when you press the button add to orderlist, the checked item in the listbox has to change.

7226218; hemlock; 22.55; 0

to 7226218; hemlock; 22.55; 1 (if i order one)

how to do this ?
as you see the textdocument is separated with an ;, and i get the tip to use
dim item(3) as string
item = textline.split(";")

and then ?

Please help, im really stuck at the moment.

best regards.
Bjorn Bats
 
Code:
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        ListBox1.Items.Add("7226218; hemlock; 22.55; 0")
    End Sub


    Private Sub ListBox1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox1.MouseUp
        Dim i As Integer = Split(ListBox1.SelectedItem, Chr(32))(3)
        ListBox1.Items.Item(ListBox1.SelectedIndex) = Replace(ListBox1.SelectedItem, i, ComboBox1.Text)
    End Sub
in that case i had a combobox with various values in it, selected a value, clicked the listbox and the item got updated to the new value ( "7226218; hemlock; 22.55; 2") in that test.
 
oke ireally a programmer nupe.

i have a listbox, an numericupdownbox and a button
and a textbox.

the listbox is filled with a textfile (after long work i have made this).
in the listbox you can select an item
in the numericupdownbox you can selected how many items you want to buy.
and the button (add to orderlist) must write the total of orderlist to the textbox, and overwrite the selected line in the listbox to the exact number that is selected in the listbox ?

so for example in the listbox the number 0 has to change to 1.
if i put the numericupdownbox to 1.
and in the texbox stands
22,55

7226218; hemlock; 22,55; 0


i really have no idea how to handle this and what to use.
an array etc ?


im really stuck here ?
can anyone help please.

best regards
bjorn bats
 
how do you want the info to appear in the textbox? like this... 22,55
and do you want the item in the listbox to read as it is , but with the 0 changed to your value ( eg: 3 )?
to clarify on the above code slightly
Code:
Dim i As Integer = Split(ListBox1.SelectedItem, Chr(32))(3)
/// that is finding the value ( where you have 0 )
/// you can do the same but put Chr(32)(2) to seperate the 22,55; then remove the ;
///
 
Back
Top