Ok from my other posts you will see I have thanks to SAMS taught myself how to code VB.NET - SQL Express the old way and am now trying to learn the new way.
To this end I have done the following and am confused to boot....
Created a new database with a single table
Created a new datasource to this database
Created a textbox on the form
Created a button on the form
Created a combobox on the form
Added a bindingsource to the form
Set the combobox to use the bindingsource
The combobox allows me to erase contents in display but does not alter list
The combobox displays the table content in order
I want to be able to insert a new record and thus see it in the combobox.
I understand that once a row is inserted to the table the combobox will update automatically
Problem is.....I cant see how to insert a new row?
I have tried something along these lines but get an error detailed below:
Where I try to create the new rwNewRow the parameter rbRowBuilder errors as not set to object.
I expect this, but the line to create the rowbuilder errors when I try to use New as it says it does not have a consturctor.
Also......all in all am I almost on track or still completely wrong in trying this way of doing things?
Thanks
To this end I have done the following and am confused to boot....
Created a new database with a single table
Created a new datasource to this database
Created a textbox on the form
Created a button on the form
Created a combobox on the form
Added a bindingsource to the form
Set the combobox to use the bindingsource
The combobox allows me to erase contents in display but does not alter list
The combobox displays the table content in order
I want to be able to insert a new record and thus see it in the combobox.
I understand that once a row is inserted to the table the combobox will update automatically
Problem is.....I cant see how to insert a new row?
I have tried something along these lines but get an error detailed below:
VB.NET:
[SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] btnAdd_Click([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] btnAdd.Click[/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] rbRowBuilder [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Data.DataRowBuilder[/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] rwNewRow [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] NewDataAccessDataSet.tranaction_descriptionsRow(rbRowBuilder)[/SIZE]
[SIZE=2]rwNewRow.Item(1) = [/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].txtNewDescription.Text[/SIZE]
[SIZE=2]rwNewRow.Item(2) = [/SIZE][SIZE=2][COLOR=#a31515]"FALSE"[/COLOR][/SIZE]
[SIZE=2]rwNewRow.Item(3) = [/SIZE][SIZE=2][COLOR=#a31515]"FALSE"[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].BindingSource1.Add(rwNewRow)[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
Where I try to create the new rwNewRow the parameter rbRowBuilder errors as not set to object.
I expect this, but the line to create the rowbuilder errors when I try to use New as it says it does not have a consturctor.
Also......all in all am I almost on track or still completely wrong in trying this way of doing things?
Thanks