Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Combo box problem

Posted on 2004-09-14
2
Medium Priority
?
249 Views
Last Modified: 2010-04-23
Hi Experts, I have populated the combobox (cbo1) with values (0-9). I have a textbox (txtValue) having a value of 5. I want to find out the location of the text value with respect to the combo box.

How could I achieve this in VB.NET?

TIA.
0
Comment
Question by:bpyeo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 10

Accepted Solution

by:
123654789987 earned 200 total points
ID: 12052128
for i = 0 to ComboBox1.Items.Count -1
if(ComboBox1.Items[i] == textBox1.Text)
{
MEssageBox.Show("The text is at the position" : i)
}

NExt i
0
 
LVL 19

Expert Comment

by:Fahad Mukhtar
ID: 12052279
Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
        MessageBox.Show("Position is "  + GetIndex(txtValue.Text))
End Sub

Private Function GetIndex(ByVal text As String) As Int32
        Dim i As Int32
        If cbo1.Items.Contains(txtValue.Text) Then
            For i = 0 To cbo1.Items.Count-1
                If text = cbo1.Items.Item(i) Then
                    Return i
                End If
            Next
        End If
End Function
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question