Code Red > .NET

BindingNavigator does not show correct data information

(1/1)

Keith™:
Ok, this one is mixed code because one project is in VB.Net, and the other is in C#. A binding navigator is desired to navigate through a table of records that list various items in the drawing. These items have been enumerated and populated into a list of objects.

The object

--- Code - C#: ---public class insert{    public struct IntData    {        private string _id;        private string _intname;        private int _streetcount;        public int StreetCount { get { return _streetcount; } set { _streetcount = value; }}        public string IntersectionName { get { return _intname; } set { _intname = value; }}        public string ID { get { return _id; } set { _id = value; }}        public IntData(string id = "")        {            _id = "";            _intname = "";            _streetcount = 0;        }    }}

--- Code - Visual Basic: ---'The list of objectsPrivate ids As List(Of insert.IntData) = insert.CycleIntvol(, True) Private Sub Form_Load(sender As Object, e As EventArgs) Handles MyBase.Load     For Each inters As insert.IntData In ids         'Create new row using predefined schema and fill it with data         Dim dr As DataRow = DataSet1.Tables("Intersections").NewRow()         dr.Item(0) = inters.ID         dr.Item(1) = inters.IntersectionName         dr.Item(2) = inters.StreetCount         DataSet1.Tables("Intersections").Rows.Add(dr)     Next     BindingNavigator1.DataBindings.Add(New Binding("Text", Me.DataSet1, "Intersections.ID", True))     BindingNavigator1.DataBindings.Add(New Binding("Tag", Me.DataSet1, "Intersections.StreetCount", True))End Sub
The BindingSource, Table, and DataSet are all design-time objects created by the IDE and when stepping through the code, the dataset shows the table and the correct number of rows and columns.

I'm sure its a rookie mistake but I'll be darned if I can see it.

Also, I have tried BindingLists, this was my last resort to try and get something working.

I know I'm gonna feel like an idiot when someone points out the simplicity of the resolution.

Sheriholty:
I do not know how many updates have been made so I can not help recommending them.

Navigation

[0] Message Index

Go to full version