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

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 1849
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

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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.