473,394 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Using a For loop on a combobox values

1
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). If u look at the picture attached u can understand what I wanted this application to do. 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

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
<a href="http://s900.photobucket.com/albums/ac207/manhaz/?action=view&current=VBSample.png" target="_blank"><img src="http://i900.photobucket.com/albums/ac207/manhaz/VBSample.png" border="0" alt="VB DataGridView"></a>
Jun 12 '10 #1
1 3251
Killer42
8,435 Expert 8TB
I don't really follow what you want the code to do.

Rather than showing the intended end result, can you please try to set down, step by step, exactly what you want to happen? That's largely what programming is. Once you've worked out in detail what to do, translating in into VB (or another programming language) is usually a relatively simple task.
Jul 17 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: BT Openworld | last post by:
I've just had to upgrade to Access 2003. Our company's main sales database started in Access V1.0 and has progressed through V2.0 and 97 without problems. I've converted it to 2003 format and have...
0
by: dbuchanan | last post by:
Hello, I want to control a bindingContext postion on my form using a comboBox. How do I set up the comboBox to do that? Thank you, dbuchanan Additional information...
1
by: Rejimonb | last post by:
Can I fill a combobox without using a loop. Using a loop will be time consuming. Reji
20
by: talktozee | last post by:
Hey, everyone! Basically, I need to insert *multiple rows* into table A from table B based upon some criteria, and I need to insert some static values along with each row from table A. For...
5
by: Nirmala123 | last post by:
hi... I want to sort the table using combobox values. I give the code here. address.html: <html> <head> <title>Add a new entry</title> </head>
1
by: The.Daryl.Lu | last post by:
Hi, two parts to my problem if someone can help address either one or both: 1. I want to SELECT everything in the table if it matches the criteria when the query button is pressed (this is just...
1
by: redskycorp | last post by:
I have repeating values in my combo box, i do want the values to repeat...any idea how to do that ? The reason is that i am taking the values from my database table "Incomplete" from the "Topic"...
3
by: nico3334 | last post by:
I'm filling in a Report with SQL data using VB code. I'm using LOOP and MoveNext. Before using MoveNext, I would like to be able to check whether the new data is equal to the previous data that was...
5
by: boss1 | last post by:
hi all, i have a problem with loop in select statement.i m using code : <select name = "s" size = "1" > <option selected>P-Code</option> <option...
14
by: Mark | last post by:
I have a table with a field that uses a combobox to populate values. The Lookup tab within table design mode is the following: Display Control Combo Box Row Source Type ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.