469,282 Members | 2,120 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

FindByText in dropdownlist

11
How to use FindByText property of dropdownlist where text to find is in a textbox? i.e

if i write,
dropdownlist1.Items.FindByText(" ' "& txt1.Text &" ' ").Selected = True

i get error
System.NullReferenceException: Object reference not set to an instance of an object
Feb 27 '07 #1
4 1709
kenobewan
4,871 Expert 4TB
Try putting txt1.text into a string, eg myString, writing it to ensure it has a value and then use:
Expand|Select|Wrap|Line Numbers
  1. dropdownlist1.Items.FindByText(myString).Selected = True
Feb 27 '07 #2
Aneri
11
Try putting txt1.text into a string, eg myString, writing it to ensure it has a value and then use:
Expand|Select|Wrap|Line Numbers
  1. dropdownlist1.Items.FindByText(myString).Selected = True




It's not working.Getting the same error.
Feb 28 '07 #3
kenobewan
4,871 Expert 4TB
Write myString...
Feb 28 '07 #4
Aneri
11
Write myString...

I tried by writing:

dim myString as string
myString = txt1.Text
dropdownlist1.FindByText(myString).Selected = True

But Getting the same error.
Feb 28 '07 #5

Post your reply

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

Similar topics

2 posts views Thread by acko bogicevic | last post: by
reply views Thread by Thomas Scheiderich | last post: by
reply views Thread by Mark | last post: by
3 posts views Thread by AK | last post: by
2 posts views Thread by | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.