Using a For loop on a combobox values

aali

New Member
In this project I have 2 Combo boxes, 1 Button and 1 GridViewControl. Both the combo boxes have some variables and their associated values, as u can see in the code. Now when the button is pressed the GridViewControl is filled with the sum of all the variable in both the combo boxes and result should be displayed in GridViewControl (I have pasted the result on the user interface). On top of each column I want to see combo boxes similar to the one I have on the form. I want to use For Loop, easy for me to understand.

I need the code for the click button to generate this sample result (pasted on the picture).

Public Class Form1
Public Total As Integer

Dim Prod1Dictionary As New Dictionary(Of String, Integer)
Dim Prod2Dictionary As New Dictionary(Of String, Integer)

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ComboBox1.Items.Add("Apple")
ComboBox1.Items.Add("Blackberry")
ComboBox1.Items.Add("Cherry")
ComboBox1.Items.Add("Select")
ComboBox1.Text = "Select"

ComboBox2.Items.Add("Grapes")
ComboBox2.Items.Add("Grapefruit")
ComboBox2.Items.Add("Guava")
ComboBox2.Items.Add("Select")
ComboBox2.Text = "Select"

Prod1Dictionary.Add("Select", 0)
Prod1Dictionary.Add("Apple", 2)
Prod1Dictionary.Add("Blackberry", 3)
Prod1Dictionary.Add("Cherry", 4)

Prod2Dictionary.Add("Select", 0)
Prod2Dictionary.Add("Grapes", 5)
Prod2Dictionary.Add("Grapefruit", 6)
Prod2Dictionary.Add("Guava", 7)

End Sub
End Class
 

Attachments

  • VB Sample.jpg
    VB Sample.jpg
    14.8 KB · Views: 209
In Basic4ppc you want to use a Table control instead of GridViewControl and
a Hashtable control. Be so kind to read the Basic4ppc help file and you will find
a solution.
 
Top