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

Null Exception Error With ComboBox

polymorphic
Error: "Object reference not set to an instance of an object"

I have a ValueMember set for a comboBox and I am wanting the value of the ValueMember for the selected Item. This is c# VS2005.

I do not understand why I am getting this error with the code below:

private void cboFindEst_SelectedIndexChanged(object sender, EventArgs e)
{
if (cboFindEst.SelectedIndex != -1)
{
string sID;
sID = cboFindEst.SelectedValue.ToString();
fillDataSet(sID);
}
}

Does anyone have an idea?

Thanks,
cj
Oct 20 '06 #1
1 1736
I fixed this. Because I was populating the comboBox via code, the data was never binding correctly so I broke down and used a bindingSource.
Oct 20 '06 #2

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

Similar topics

3
by: Professor Frink | last post by:
First off, I apologize if this gets long. I'm simply trying to give you all enough information to help me out. I'm writing (almost finished, actually), my first VB.Net application. It's a forms...
0
by: Sandra Setz | last post by:
Hi, I have a continuous form with a combobox that gets its values from a table with no null values. For some reason, whenever I add a new record in the form, Access tries to look up the current...
3
by: google | last post by:
This is something I've done plenty of times in '97, but I can't seem to get it to work correctly in Access 2003. Say, for example, I have a form with an unbound combobox, the data source is a...
0
by: Spitz | last post by:
I keep getting the exception An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll (Additional information: Object reference not set to an instance of an...
2
by: Jac | last post by:
Hey, How can I set the display value of a combobox empty? But all the posible choices are available when I push the trianglebut. Sometimes if I set the selecteditem = null it works, other...
4
by: Craig831 | last post by:
First off, I apologize if this gets long. I'm simply trying to give you all enough information to help me out. I'm writing (almost finished, actually), my first VB.Net application. It's a forms...
4
by: MadCrazyNewbie | last post by:
Hey Group, Just another quick question: I have the following bit of code: Private Sub cboPasswordListsDepartment_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)...
4
by: Brad | last post by:
Now I am encountering my second very strange problem. I will describe the first one later. But my current problem lies with trying to bind to a combobox: Try If clubID <> "" And txtYear.Text <>...
4
by: Greg (codepug | last post by:
Private Sub cboBody_KeyDown(KeyCode As Integer, SHIFT As Integer) 'Delete combobox entry if Del or Backspace key is hit. If (KeyCode = 46) Or (KeyCode = 8) Then Me.cboBody = "" End Sub I have...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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:
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
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...

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.