473,473 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

FindByText in dropdownlist

11 New Member
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 1852
kenobewan
4,871 Recognized Expert Specialist
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 New Member
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 Recognized Expert Specialist
Write myString...
Feb 28 '07 #4
Aneri
11 New Member
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

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

Similar topics

12
by: Stanley J Mroczek | last post by:
How do you load a dropdownlist when edit is clicked in a datagrid ? <Columns> <asp:BoundColumn DataField="OptionDescription" ItemStyle-Wrap="True" HeaderText="Option...
2
by: Dominic | last post by:
Hi guys, I'm not sure if this question belongs to FAQ, but I couldn't find a concrete answer. I created a Datagrid control using ItemTemplate, but it's NOT a in-place editing datagrid. One of...
2
by: acko bogicevic | last post by:
I have combobox which is filled from database. Afterwords i will get a criteria for searching a combo by value. Hao can i make item in combo to be selected when value in combo match critiria....
0
by: Thomas Scheiderich | last post by:
I have a screen that is trying to search a listbox both by FindByText and FindByValue. The FindByValue is working find, but the FindByText is not finding anything. This is even if I copy the text...
0
by: Mark | last post by:
I have a dropdownlist that is dynamically populated. I want to make one of the items be selected by default based on PART of the text that is displayed. However, the FindByText method of the...
3
by: AK | last post by:
Hi, I am using FindByText method of dropdownlist to change the selected item in a dropdownlist like this: DropDownList1.Items("mySelectedText").Selected = True It doesn't seem to be doing...
2
by: | last post by:
Hi, is it FindByText case Sensitive? How to set it to case insensitive? Thanks in advance.
6
by: prpleprncs | last post by:
I have a dropdownlist that is selected on page_load. the values of the dropdown comes from the database using a datasource at design time. the value that needs to be selected comes from the...
0
by: asmx126453 | last post by:
Hey mensen I am having some big troubles here i tryd solving it myself with internet for 2 days but i kind fix it. Its about this i have a DotNet project that alrydi is online and working for...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.