473,396 Members | 1,918 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,396 software developers and data experts.

iterate through items in a comobox to match values

194 100+
Hello,

I am trying to match the values of a combo box which are typed inside a combo box with the comb box items, which are bind to a datasource. i can see the items in the combo box and if i get the selecteditem its working fine means nothing is wrong with the connection and other things.

but when im trying to match the values im getting this error:

System.Data.DataRowView

and this error continues to display equal to the number of rows inside table. im using the following code:
Expand|Select|Wrap|Line Numbers
  1. Public Class admForm
  2.     Dim itm As Object
  3.     Dim result As String
  4.  
  5.     Private Sub admForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  6.         'TODO: This line of code loads data into the 'admDataSet.tblAdm' table. You can move, or remove it, as needed.
  7.         Me.TblAdmTableAdapter.Fill(Me.admDataSet.tblAdm)
  8.  
  9.     End Sub
  10.  
  11.     Private Sub cboAdm_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboAdm.LostFocus
  12.  
  13.         For Each itm As Object In cboAdm.Items
  14.             result = itm.ToString()
  15.             If result <> Me.cboAdm.Text Then
  16.                 MsgBox(result)
  17.             End If
  18.         Next
  19.  
  20.     End Sub
  21. End Class
  22.  
i have already set the display member of the combo box. everything is done from the property sheet using visual studio. i just want to match the text against the items of the combo box. for example in pseudo code


if comboBox.text <> combobox.items.item then
''add into the database

end if

here i just need to check if the typed values are already in the combo box's items collection. please tell me how i can check this.

thanx
May 9 '10 #1
1 5444
mfaisalwarraich
194 100+
now im using a different approach by filling in the items into the combobox. here is the code:
Expand|Select|Wrap|Line Numbers
  1. Public Class admForm
  2.     Dim itm As Object
  3.     Dim result As String
  4.     Dim ds As DataSet
  5.     Dim dt As New DataTable
  6.  
  7.     Private Sub admForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  8.         'TODO: This line of code loads data into the 'admDataSet.tblAdm' table. You can move, or remove it, as needed.
  9.         Me.TblAdmTableAdapter.Fill(Me.admDataSet.tblAdm)
  10.         dt = admDataSet.tblAdm
  11.         For Each s As String In dt.Rows.Item(0).Item("fruit")
  12.         ComboBox1.Items.Add(s)
  13.         Next
  14.     End Sub
  15.  
  16.  End Class
  17.  
the above code fill the comobox with the following value:
a
p
p
l
e

because the first row in the fruit column is "apple". please tell me how i can fill the combobox with the column values.
thanx
May 9 '10 #2

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

Similar topics

8
by: Charlotte Henkle | last post by:
Hello; I'm pondering how to count the number of times an item appears in total in a nested list. For example: myList=,,] I'd like to know that a appeared three times, and b appeared twice,...
1
by: Andrew Banks | last post by:
I have a table of product orders. It contains a row for "platform" and I need to return how many times each platform is listed in the DB Example data for platform could be: XBOX XBOX XBOX...
0
by: Jack | last post by:
Hi, I have the following problem. I have a main data entry form which has a link to a detailed data entry form. The value of the link in the main form is the sum total of all the line items...
2
by: jupitermoonbeam | last post by:
Hi, I wondered if anyone can help. I have scowered the web and found absolutely nothing that relates to my particular problem and I am pulling my hair out. Basically, I have a scenario where...
10
by: Girish | last post by:
Hi Everyone, I am passing a form to a php script for further processing. I am able to retrieve the last value set for that given form variable using $variable=$_REQUEST;
0
by: fariba123 | last post by:
there are two arrays: $players = array( "23" => "Michael Jordan", "32" => "Michael Johnson" ); $current_player = array( "player_id" => "23", "age" => "22"
22
by: Yakov | last post by:
What would be the nicest way to write the loop for all values of unsigned short (0..0xffff), usnig 'unsigned short port;' as an index ? For comparison, there is just one way to write the for(k=0;...
15
RMWChaos
by: RMWChaos | last post by:
As usual, an overly-long, overly-explanatory post. Better too much info than too little, right? A couple weeks ago, I asked for some assistance iterating through a JSON property list so that my...
1
by: C C++ C++ | last post by:
Hi All, I am c++ beginner.. I have thread create function like this pthread_create(&ThreadA,NULL,threadWork::requestThread,(void *)&ResultSet); // <--- ResultSet is hasp_map with around 10...
13
by: Nader | last post by:
Hello, I have a dictionary and will get all keys which have the same values. d = {('a' : 1), ('b' : 3), ('c' : 2),('d' : 3),('e' : 1),('f' : 4)} I will something as : d.keys(where their...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.