G
Guest
Hello
I already posted this question, but received no response
I'll try to word it better :
I have a form with a lisbox (LBox1), a button, that when pressed populates LBox1, and a tab control with 2 pages
On the 2nd tab page is another listbox (LBox2), whose values are based on what is selected in LBox1
If I run the project, and go directly to the 2nd tab page, then populate LBox1, everything works great
If I populate LBox1 first, then click on the 2nd tab page, I get the error message
"An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dl
Additional information: Cannot modify the Items collection when the DataSource property is set.
The code that triggers the error is in the following sub
Private Sub get_all_CBs(
lBox2.datasource = Nothin
lBox2.items.Clear(
lBox2.Refresh(
Dim DI2 as String = txtCPID.Tex
Dim ConStr2 as String = "...my connection string...
Dim dsACB as DataSet = SqlHelper.ExecuteDataset(ConStr2, CommandType.Text, ...my SQL code...
lBox2.DataSource = dsACB.Tables(0) <<----- this is the line that triggers the error..
lBox2.DisplayMember = "STR_BLOCK_NUMBER
Please help!!
Thanks in advance
Ambe
I already posted this question, but received no response
I'll try to word it better :
I have a form with a lisbox (LBox1), a button, that when pressed populates LBox1, and a tab control with 2 pages
On the 2nd tab page is another listbox (LBox2), whose values are based on what is selected in LBox1
If I run the project, and go directly to the 2nd tab page, then populate LBox1, everything works great
If I populate LBox1 first, then click on the 2nd tab page, I get the error message
"An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dl
Additional information: Cannot modify the Items collection when the DataSource property is set.
The code that triggers the error is in the following sub
Private Sub get_all_CBs(
lBox2.datasource = Nothin
lBox2.items.Clear(
lBox2.Refresh(
Dim DI2 as String = txtCPID.Tex
Dim ConStr2 as String = "...my connection string...
Dim dsACB as DataSet = SqlHelper.ExecuteDataset(ConStr2, CommandType.Text, ...my SQL code...
lBox2.DataSource = dsACB.Tables(0) <<----- this is the line that triggers the error..
lBox2.DisplayMember = "STR_BLOCK_NUMBER
Please help!!
Thanks in advance
Ambe