I added Items to the combo box. How do I define these items
Combo Box has a value of 1' = 100' (This is what you see in the drop down list), but I would like to convert this to 1/1200. Can I do this Define {1' = 100'} = {1/1200}. If so, how By the way I would like the 1/1200 to be an Integer(I Think) so it returns a value of .0008333 repeating.
Thanks, Mike

Combo Box Help (beginner)
Les Thompson
hi,
forget about vb6, you have 2 columns not three, one is just a text the other column has values divided by / , if you want the " to appear in the text you can add it twice like that "1/16 = "" 1 "" "
hope this helps
DavidTM
hi,
you can try something like this
Public Class Form1
'this form contains just one combobox Dim dt As DataTable = New DataTable
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dt.Columns.Add("value")
dt.Columns.Add("display")
AddProduct(100, "1/1200")
AddProduct(200, "1/1400")
AddProduct(300, "1/1500")
ComboBox1.DataSource = dt
ComboBox1.DisplayMember = "value" ComboBox1.ValueMember = "display" End Sub Private Sub AddProduct(ByVal valuemember As Integer, ByVal displayMember As String)
Dim dr As DataRow
dr = dt.NewRow
dr("value") = valuemember
dr("display") = displayMember
dt.Rows.Add(dr)
End Sub Private Sub ComboBox1_DropDownClosed(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.DropDownClosed
Dim keys() As String = ComboBox1.SelectedValue.ToString.Split("/")
Dim value As Double = Double.Parse(keys(0)) / Double.Parse(keys(1))
MessageBox.Show(value)
End Sub
End Class
hope this helps
JP.DEV
ThisBytes5
hi,
combobox have a valuemember and displaymember you can use the displaymember as " 100" and value member "1/1200" but first you have to have a table contian this data
also .0008333 is double not integer
hope this helps
Makarand_Keer
Macy-Mike
Perfect, Thanks alot!
So I modified the code to read as follows:
AddProduct(
"1' = 100'", "1/1200")Next do I add a " with in the " "s
I want it to read as:
AddProduct("1/16" = 1'", "1/192")
From what I can remember from VB6.0 it was something like + Chr(34) but that doesn't seem to work. Any ideas
RabBsl
I'm still struggling with this.
I changed the top to read as: Load_Combo(ByVal combo As ComboBox) Is this right I'm trying to get 3 comboboxs to have the same content but return different values.