Out of Range Exception

B

Brad

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 <> "" Then
DsEvents1.Clear()
daEventInfo.SelectCommand.Parameters(0).Value = clubID
daEventInfo.SelectCommand.Parameters(1).Value = txtYear.Text
daEventInfo.Fill(DsEvents1)
ElseIf txtYear.Text = "" Then
MsgBox("Event Year needs to be selected", MsgBoxStyle.Information)
Exit Sub
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try

The dataset DsEvents1 is supposed to bind to a combobox. Instead on the fill, I get:

A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in system.windows.forms.dll

Additional information: Specified argument was out of the range of valid values.

If I hit Continue, then the combobox fills as it should. I deleted this combobox and re-added it, I changed the combo box to a list box and still get the same result. If I remove the binding from the control then I do not get an error message. I guess my next step would be to iterate through the dataset rows and add the item to the combo box, right?

The other error I was referring to is with that Crystal Reports problem. I get this error:

A first chance exception of type 'System.IO.FileNotFoundException' occurred in crystaldecisions.crystalreports.engine.dll

Additional information: The system cannot find the file specified.

But if I hit Continue from the debugger twice, the report displays properly.

All of this behavior occurs only in the IDE. Any compiled programs still work just fine.

Thanks for any information.

Brad
 
B

Brad

Update:

By iterating through the rows and adding the items to the combobox, it worked. But I still want to know why the databinding did not work.


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 <> "" Then
DsEvents1.Clear()
daEventInfo.SelectCommand.Parameters(0).Value = clubID
daEventInfo.SelectCommand.Parameters(1).Value = txtYear.Text
daEventInfo.Fill(DsEvents1)
ElseIf txtYear.Text = "" Then
MsgBox("Event Year needs to be selected", MsgBoxStyle.Information)
Exit Sub
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try

The dataset DsEvents1 is supposed to bind to a combobox. Instead on the fill, I get:

A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in system.windows.forms.dll

Additional information: Specified argument was out of the range of valid values.

If I hit Continue, then the combobox fills as it should. I deleted this combobox and re-added it, I changed the combo box to a list box and still get the same result. If I remove the binding from the control then I do not get an error message. I guess my next step would be to iterate through the dataset rows and add the item to the combo box, right?

The other error I was referring to is with that Crystal Reports problem. I get this error:

A first chance exception of type 'System.IO.FileNotFoundException' occurred in crystaldecisions.crystalreports.engine.dll

Additional information: The system cannot find the file specified.

But if I hit Continue from the debugger twice, the report displays properly.

All of this behavior occurs only in the IDE. Any compiled programs still work just fine.

Thanks for any information.

Brad
 
W

W.G. Ryan eMVP

Brad:

Where are you setting the datasource in there?

--
W.G. Ryan MVP (Windows Embedded)

TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
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 <> "" Then
DsEvents1.Clear()
daEventInfo.SelectCommand.Parameters(0).Value = clubID
daEventInfo.SelectCommand.Parameters(1).Value = txtYear.Text
daEventInfo.Fill(DsEvents1)
ElseIf txtYear.Text = "" Then
MsgBox("Event Year needs to be selected", MsgBoxStyle.Information)
Exit Sub
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try

The dataset DsEvents1 is supposed to bind to a combobox. Instead on the
fill, I get:

A first chance exception of type 'System.ArgumentOutOfRangeException'
occurred in system.windows.forms.dll

Additional information: Specified argument was out of the range of valid
values.

If I hit Continue, then the combobox fills as it should. I deleted this
combobox and re-added it, I changed the combo box to a list box and still
get the same result. If I remove the binding from the control then I do not
get an error message. I guess my next step would be to iterate through the
dataset rows and add the item to the combo box, right?

The other error I was referring to is with that Crystal Reports problem. I
get this error:

A first chance exception of type 'System.IO.FileNotFoundException' occurred
in crystaldecisions.crystalreports.engine.dll

Additional information: The system cannot find the file specified.

But if I hit Continue from the debugger twice, the report displays properly.

All of this behavior occurs only in the IDE. Any compiled programs still
work just fine.

Thanks for any information.

Brad
 
B

Brad

Mr Ryan,

If you read my message from this morning I discovered the whole problem. At
one time in the debugger, I had turned on "Break into the debugger" for
exceptions so this is why the program has been breaking - even in Crystal
Reports. This might be a case for one of your seminars. I wasted two days
(pretty much) of programming time due to a small things that was turned on
and forgotten about. Live and learn I guess.

Thanks for the help that you give.

Brad
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top