When i tried to scroll down, is seems that the row data is blank or invisible. Pls help.
Imports NineRays.Windows.Forms.Grids
Imports NineRays.Windows.Forms.Data
Public Class Form1
Shared Test As DataTable = Data()
Private Sub Start_Btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Start_Btn.Click
Dim arr1 As DataTable = Test
FlyGrid1.BeginInit()
Try
Dim i As Integer
'Add columns
For i = 0 To arr1.Columns.Count - 1
Dim dc As DataColumn = arr1.Columns(i)
Dim col As Column = New Column(dc.Caption, dc.ColumnName)
' add new column
FlyGrid1.Columns.Items.Add(col)
Next i
' connect to a data table
FlyGrid1.Rows.DataSource = arr1
Finally
FlyGrid1.EndInit()
End Try
BackgroundWorker1.RunWorkerAsync()
End Sub
Private Sub BackgroundWorker1_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
While Not BackgroundWorker1.CancellationPending
' Add row dt
Dim dr_new As DataRow
dr_new = Test.NewRow
dr_new.Item("Col1") = "Col1"
dr_new.Item("Col2") = "Col2"
dr_new.Item("Col3") = "Col3"
dr_new.Item("Col4") = "Col4"
dr_new.Item("Col5") = "Col5"
dr_new.Item("Col6") = "Col6"
dr_new.Item("Col7") = "Col7"
dr_new.Item("Col8") = "Col8"
dr_new.Item("Col9") = "Col9"
dr_new.Item("Col10") = "Col10"
dr_new.Item("Col11") = "Col11"
dr_new.Item("Col12") = "Col12"
dr_new.Item("Col13") = "Col13"
dr_new.Item("Col14") = "Col14"
dr_new.Item("Col15") = "Col15"
dr_new.Item("Col16") = "Col16"
dr_new.Item("Col17") = "Col17"
dr_new.Item("Col18") = "Col18"
dr_new.Item("Col19") = "Col19"
dr_new.Item("Col20") = "Col20"
Test.Rows.Add(dr_new)
BackgroundWorker1.ReportProgress(0, "test")
System.Threading.Thread.Sleep(500)
End While
End Sub
Private Sub BackgroundWorker1_ProgressChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles BackgroundWorker1.ProgressChanged
FlyGrid1.BeginInit()
Try
FlyGrid1.Refresh()
Finally
FlyGrid1.EndInit()
End Try
End Sub
Private Sub Cancel_Btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Btn.Click
BackgroundWorker1.CancelAsync()
End Sub
Private Sub BackgroundWorker1_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted
MsgBox("Cancelled")
End Sub
Public Shared Function Data() As DataTable
Dim dt As New DataTable
dt.Columns.Add("Col1")
dt.Columns.Add("Col2")
dt.Columns.Add("Col3")
dt.Columns.Add("Col4")
dt.Columns.Add("Col5")
dt.Columns.Add("Col6")
dt.Columns.Add("Col7")
dt.Columns.Add("Col8")
dt.Columns.Add("Col9")
dt.Columns.Add("Col10")
dt.Columns.Add("Col11")
dt.Columns.Add("Col12")
dt.Columns.Add("Col13")
dt.Columns.Add("Col14")
dt.Columns.Add("Col15")
dt.Columns.Add("Col16")
dt.Columns.Add("Col17")
dt.Columns.Add("Col18")
dt.Columns.Add("Col19")
dt.Columns.Add("Col20")
Return dt
End Function
End Class