954,517 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How Do I Get Value Selected From ComboBox?

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

manal
Junior Poster
122 posts since Mar 2006
Reputation Points: 37
Solved Threads: 17
 

Hi,

x=combobox.text

Loren Soth

Lord Soth
Posting Whiz in Training
233 posts since Mar 2006
Reputation Points: 28
Solved Threads: 4
 

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 tags in a 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

Lord Soth
Posting Whiz in Training
233 posts since Mar 2006
Reputation Points: 28
Solved Threads: 4
 
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!!!

salmansulaiman
Newbie Poster
2 posts since Jul 2007
Reputation Points: 10
Solved Threads: 1
 

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.

ZachMack
Newbie Poster
1 post since Sep 2008
Reputation Points: 10
Solved Threads: 1
 

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

manal
Junior Poster
122 posts since Mar 2006
Reputation Points: 37
Solved Threads: 17
 

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

ad65222
Newbie Poster
3 posts since Jun 2009
Reputation Points: 10
Solved Threads: 0
 

i think its combobox.selecteditem.tostring

eloelo22
Newbie Poster
6 posts since Jul 2009
Reputation Points: 10
Solved Threads: 1
 

or like these combobox.selectedvalue.tosrting

eloelo22
Newbie Poster
6 posts since Jul 2009
Reputation Points: 10
Solved Threads: 1
 

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

ghelghely
Newbie Poster
1 post since Mar 2010
Reputation Points: 10
Solved Threads: 0
 

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

Thread Closed.

__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You