0

I'm attempting to run a windows desktop application and I'm getting the following error:

Application: xxx.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentOutOfRangeException
   at System.Windows.Forms.ComboBox.Select(Int32, Int32)
   at xxx.win.shared.FancyComboBox.OnTextChanged(System.EventArgs)
   at xxx.win.shared.IDComboBox.OnTextChanged(System.EventArgs)
   at System.Windows.Forms.Control.set_Text(System.String)
   at System.Windows.Forms.ComboBox.set_Text(System.String)
   at System.Windows.Forms.ComboBox.UpdateText()
   at System.Windows.Forms.ComboBox.set_SelectedIndex(Int32)
   at System.Windows.Forms.ComboBox.set_Text(System.String)
   at xxx.win.FrmSearch..ctor()
   at xxx.win.Startup.Main()

I've removed all installed instances of the .NET framework and installed different versions to test and the outcome is still the same.

I ran the .NET version checker and this is what's currently installed:

v3.0  3.0.30729.4926  SP2
v3.5  3.5.30729.4926  SP1
v4
  Client  4.8.03761
  Full  4.8.03761
v4.0
  Client  4.0.0.0

The application targets .NETFramework version 4.6.2. So I should be covered on that front. The same application runs on another machine with the same .NETFramework setup

Beepa
  • 3
  • 1
  • 2

2 Answers2

1

The problem you're dealing with isn't related to the .NET framework.

If you look at the exception stack, you'll see that an ArgumentOutOfRangeException is raised by one ComboBox of your FrmSearch form. Try to find out which combo box is raising the exception and what condition in your code could raise such exception.

If your ComboBox is populated with external data (file, database, ...), make sure the data source is available to your application once deployed.

The_Black_Smurf
  • 5,178
  • 14
  • 52
  • 78
0

@Jimi is correct in his comment, it is not a framework issue. The System.ArgumentOutOfRangeException is usually something to do with trying to access or select a value in an array or list that is outside the range of the array or list.

In your stack trace it looks like it is coming from the ComboBox System.Windows.Forms.ComboBox.Select(Int32, Int32)

make sure that the ComboBox has values in it and if not your code does not try and select a value.

If there are no values in the combobox and you are doing something like combobox.Select(1) you will get the error because 1 is outside the range of values in the ComboBox.

CobyC
  • 2,058
  • 1
  • 18
  • 24