1) The column to the right of where I put 1 at the bottom of the grid should precede the rows with 2 to 7 in the column before it.
You mean the grid should be sorted by that column? (possibly in combination with another column also.. but thats academic)
2) Where I put 2 is where I am trying to put a delimiter of Y, I specify how much data I will be adding and when it reaches the last piece of data I wish to include a way of
identifying this.
THis doesnt make a lot of sense to me, to be honest
VsrDataRow.RecordId = Me.RaceVenue.Text + Me.RaceDate.Text.ToCharArray(0,
10) + "-" + Me.RaceTime.Text.ToCharArray(0, Me.RaceTime.TextLength) + "-" +
RowCount.ToString
...
VsrDataRow.RaceTitle = FlatStr + "" + HurdleStr + "" + ChaseStr + " " + HcapStr
+ " " + TitlesDebug.Text
Uhmm.. The operator for concatenating strings in VB.NET is &, not +.. mmkay?
Try this, actually, its better way to build strings:
VsrDataRow.RaceTitle = String.Format("{0}{1}{2} {3} {4}", FlatStr, HurdleStr, ChaseStr, HcapStr, TitlesDebug.Text)
Dim s as String = myString1 & myString2
This will stop VB trying to convert strings to numbers when you "numerical string" + "numerical string" them
"1" & "2" = "12"
"1" + "2" = "3", or 3, or something like that.. i dunno.. its not soemthing I ever did
If Count = 0 Then
Me.EquinexMasterSqlDataSet.VsrData.Rows
(Me.EquinexMasterSqlDataSet.VsrData.Rows.Count - 1).Item(10) = FlatStr + ""
+ HurdleStr + "" + ChaseStr + " " + HcapStr + " " + TitlesDebug.Text
Um... if COunt = 0, then youre gonna subt6ract 1 from it, and then try and access that rowid and do what?? There is no row at position -1
Note.. We dont put rows in datatables in order! Sorting is a function of the DataView or the Bindingsource, NOT the datatable. The table holds data, the view sorts and filters it and the grid shows it. If you said:
MyGrid.DataSource = MyDataTable
then actually, the grid is looking at the MyTable.DefaultView view.. sort that! and also set the sort order on soemthing sensible. You make rows appear where you want them to appear NOT by inserting them into the table in certain places but simply by inserting them any old place but with the correct sorted columns set up so they appear where you want!
(Me.EquinexMasterSqlDataSet.VsrData.Rows.Count - 2).Item(20) = "Y"
Again.. we dont really refer to Item(20) because that's generic. You should at least try to keep the type specific stuff, which is default property stuff..
Example:
MyDataTable.Rows(0) ' returns a DataRow, which is a generic supertype of a MyDataTableRow
MyDataTable(0) ' returns the type specific row
If you dont know much about OO languages, take some time out to read on Boxing.. Boxing is where you take a parent and assigna child to it. ALl the child specialities are hidden, but still available via casting:
Dim p as ParentType = New ChildType 'child inherits from parent
p.ParentProperty 'available
p.ChildProperty 'not available
DirectCast(p, ChildTYpe).ChildProperty 'available because it is actually a hild type stored in the parent variable, we jsut use a cast to unbox it
So
MyDataTable(0) returns you the first child row.. and its type specific.Suppose the column at item(20) is called HorseName:
MyVsrDataTable(10).HorseName
'available, row returned from indexer is type specific
MyVsrDataTable.Rows(10).HorseName
'not available; row returned is a child, but boxed up in parent type DataRow which has no HorseName property
DirectCast(MyVsrDataTable.Rows(10), MyVsrDataRow).HorseName
' available, but what a mess and long to type when we can just use the simpler form from the first line
Me.DataGridView1.Update()
Should be unnecessary