Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Combining Info from Two List Boxes
 

Combining Info from Two List Boxes

Hello,

I'm very very new to Visual Basics. I'm using 2005 express and I'm stuck on the list boxes. In my project I have two list boxes which have completely different sets of data in them. The data is numeric. Here is what I need to do:

1. I need to create an error message so if someone has info in one box but not the other box they will get an error message saying there must be info in box boxes. I would prefer to make it so the user has to have the same number of items in each box

2. When a button is clicked I need the info in both boxes to generate the sum and divide the answer by two

3. Lastly I would like to know how to make it so that if someone wants to change a number in a listbox they can and the new number will go in the same spot as the number they changed.

I know this is a lot but hopefully someone can help me.

Thanks

akilah  Wednesday, November 15, 2006 9:31 PM

some guidelines:

Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown

If e.KeyCode = Keys.Enter Then

Me.ListBox1.Items.Add(Me.TextBox1.Text)

Dim T As Integer = 0

For Each s As Integer In Me.ListBox1.Items

T += s

Next

MsgBox(T / 2)

End If

End Sub

the rest is yours :)

hrubesh  Thursday, November 16, 2006 8:22 AM

some guidelines:

Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown

If e.KeyCode = Keys.Enter Then

Me.ListBox1.Items.Add(Me.TextBox1.Text)

Dim T As Integer = 0

For Each s As Integer In Me.ListBox1.Items

T += s

Next

MsgBox(T / 2)

End If

End Sub

the rest is yours :)

hrubesh  Thursday, November 16, 2006 8:22 AM
Thanks I will try it.
akilah  Thursday, November 16, 2006 3:43 PM

You can use google to search for other answers

Custom Search

More Threads

• DataGrid
• Edit mode for DataGrid
• DataGridView Scrolling Problem
• What BindingSource functions does ComboBox use?
• Status Strip ProgressBar not Updated from Child windows in MDI Application
• export the data from text file to the table in the Database
• How can I check for Null dataset
• Master-Child Datagridview design?????
• Data Validation for a bound VB form
• Raising INotifyPropertyChanged on object also resets current item on list