1,105,534 Community Members

How Do I Get Value Selected From ComboBox?

Member Avatar
manal
Junior Poster
122 posts since Mar 2006
Reputation Points: 27 [?]
Q&As Helped to Solve: 17 [?]
Skill Endorsements: 0 [?]
 
0
 

Salam...
I need to get value that has been selected from combobox ..
the values in combobox is taken from column's contents of one of tabel in database..so once i write if x=combobox.selectedvalue..i got error that i Additional information: Operator is not valid for type 'DataRowView' and string

Member Avatar
Lord Soth
Posting Whiz in Training
233 posts since Mar 2006
Reputation Points: 4 [?]
Q&As Helped to Solve: 4 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi,

x=combobox.text

Loren Soth

Member Avatar
Lord Soth
Posting Whiz in Training
233 posts since Mar 2006
Reputation Points: 4 [?]
Q&As Helped to Solve: 4 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi,

PHP is a server side web scripting language where you don't have direct access to client side web controls like text and combo boxes. What you should do is to put <input> tags in a <form action="POST"> tag with destination to another (to the same is also possible, slightly more complicated) PHP page where contents of the selected combobox item will be returned to the new PHP page as $_POST["nameofpostvar"] variable when submitted. On server side scripting each action requires a round trip to the server.

Loren Soth

Member Avatar
salmansulaiman
Newbie Poster
2 posts since Jul 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

Salam...
I need to get value that has been selected from combobox ..
the values in combobox is taken from column's contents of one of tabel in database..so once i write if x=combobox.selectedvalue..i got error that i Additional information: Operator is not valid for type 'DataRowView' and string

Hey sorry but i dont know the ans to your Q. yours was the first query that came around so ...just asking you
I just wanted to know how do you go about this site...i mean...if i wanted to post a Q about JAVA etc...you see its an informative site but its tough moving in here...how do i do it???? if you can help me out...really appreciate it!!! thank you!!!

Member Avatar
ZachMack
Newbie Poster
1 post since Sep 2008
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

In VB, the combobox's value can be retrieved several ways. x=combobox.selectedvalue will return a row like the error says. What intellisense doesn't tell you is that you can retrieve the information from this row using .Item(0) so x=combobox.selectedvalue.item(0) will give you the value including the type like integer, etc.

Member Avatar
manal
Junior Poster
122 posts since Mar 2006
Reputation Points: 27 [?]
Q&As Helped to Solve: 17 [?]
Skill Endorsements: 0 [?]
 
0
 

thank you all especailly to ZachMack who remind me of my first post here :D
and welcome to DaniWeb.

Question Answered as of 5 Years Ago by Lord Soth, salmansulaiman and ZachMack
Member Avatar
ad65222
Newbie Poster
3 posts since Jun 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

hi guys...i m new to coding and all ....can smone suggest me how to take values in list box and how to select an item(multiple selection also).....its important....please send me the code

Member Avatar
eloelo22
Newbie Poster
6 posts since Jul 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

i think its combobox.selecteditem.tostring

Member Avatar
eloelo22
Newbie Poster
6 posts since Jul 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

or like these combobox.selectedvalue.tosrting

Member Avatar
ghelghely
Newbie Poster
1 post since Mar 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

This Will work for sure
TextBox2.Text = ComboBox1.Items(0)

Member Avatar
__avd
Posting Genius (adatapost)
6,703 posts since Oct 2008
Reputation Points: 1,811 [?]
Q&As Helped to Solve: 1,272 [?]
Skill Endorsements: 61 [?]
Moderator
 
0
 

Please do not resurrect old threads. If you have any questions, start your own thread.

Thread Closed.

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article