
Originally Posted by
dunfiddlin
Er ... what does that actually mean?
A problem is similar to this thread where you helped. Now combobox take a function of datagridtable.
I find code which find specific value and modified to my problem but it only find value, not remove lowest values. Maybe it can be modified to works, or you have some other idea?
Here is a code:
Code:
Public Class Form1
Private bsData As New BindingSource
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim tbl As New DataTable()
tbl.Columns.Add("ID", GetType(Int32))
tbl.Columns.Add("Number")
tbl.LoadDataRow(New Object() {1, 1}, True)
tbl.LoadDataRow(New Object() {2, 2}, True)
tbl.LoadDataRow(New Object() {3, 3}, True)
tbl.LoadDataRow(New Object() {4, 4}, True)
ComboBox1.DisplayMember = "Number"
ComboBox1.ValueMember = "ID"
bsData.DataSource = tbl
ComboBox1.DataSource = bsData
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Number As Single = TextBox1.Text
Dim Position = bsData.Find("Number", Number)
If Position <> -1 Then
bsData.Position = Position
Else
MessageBox.Show("'" & Number & "' was not located.")
End If
End Sub
End Class