Hi,
I have a DataGrid to which I want the program add from time to time a new
row, without redrawing the whole DataGrid. So I don't want to add the new
Row to the DataSource and than do a Refresh, but I want it kind of directly
add it to the DataGrid so it only adds the new row.
Does anybody knows how to do this? Or what I'd better use for this?
The reason I want it is that repainting the (Custom)DataGrid takes some
time, and I don't want to repaint it the whole time when I Add a new Row
(every 5-6 seconds a new Row should be added).
Thanks a lot in advance,
Pieter 5 1346
Hi Pieter,
I try to get it clear to me, do you mean you want to set the datasource to
nothing and after that set it again, is that something you want to archieve?
:-)
Cor
Well I don't knwo really :-)
I just have a DataGrid with like 20 rows in it. I have a process that is
turning, and that should add every 5 seconds a new Row to my DataGrid.
When the new Row is added, I don't want that it repaints the whole DataGrid,
but just adds the new row at the end of it.. :-)
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl... Hi Pieter,
I try to get it clear to me, do you mean you want to set the datasource to nothing and after that set it again, is that something you want to
archieve? :-)
Cor
Hi,
The datagrid will redraw itself when you add a row. Post your code
for the datagrid column style maybe we can help speed it up some.
Ken
-----------------------
"DraguVaso" <pi**********@hotmail.com> wrote in message
news:uf****************@TK2MSFTNGP11.phx.gbl...
Hi,
I have a DataGrid to which I want the program add from time to time a new
row, without redrawing the whole DataGrid. So I don't want to add the new
Row to the DataSource and than do a Refresh, but I want it kind of directly
add it to the DataGrid so it only adds the new row.
Does anybody knows how to do this? Or what I'd better use for this?
The reason I want it is that repainting the (Custom)DataGrid takes some
time, and I don't want to repaint it the whole time when I Add a new Row
(every 5-6 seconds a new Row should be added).
Thanks a lot in advance,
Pieter
Hi Pieter,
I was curious and made this, in my idea this goes in batches, what is it you
want to archieve what you said, however it goins very smooth on this sunny
day here.
:-)
Cor
Dim dt As DataTable
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
dt = New DataTable("Pieter")
dt.Columns.Add("Time", GetType(System.DateTime))
DataGrid1.DataSource = dt
Dim ts As New DataGridTableStyle
ts.MappingName = "Pieter"
Dim column As New DataGridTextBoxColumn
ts.GridColumnStyles.Add(column)
DataGrid1.TableStyles.Add(ts)
column.MappingName = "Time"
column.HeaderText = "Tijd"
column.Width = 50
column.Format = ("HH:mm:ss")
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Timer1.Tick
For i As Integer = 0 To 20
Dim dr As DataRow = dt.NewRow
dr(0) = Now
dt.Rows.Add(dr)
DataGrid1.ScrollToRow(dt.Rows.Count - 1)
Next
End Sub
End Class
Public Class MyDataGrid
Inherits DataGrid
Sub ScrollToRow(ByVal row As Integer)
If Not Me.DataSource Is Nothing Then
Me.GridVScrolled(Me, _
New ScrollEventArgs(ScrollEventType.LargeIncrement, row))
End If
End Sub
End Class
Thanks Cor!
I tried it and indeed it goes very smooth, hehe :-)
Once again I was looking to far and made it too complicated, hehe :-)
Thanks a lot! And enjoy the sun overthere! Here below it's sunny too :-)
Pieter
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... Hi Pieter,
I was curious and made this, in my idea this goes in batches, what is it
you want to archieve what you said, however it goins very smooth on this sunny day here.
:-)
Cor
Dim dt As DataTable Private Sub Form1_Load(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles MyBase.Load dt = New DataTable("Pieter") dt.Columns.Add("Time", GetType(System.DateTime)) DataGrid1.DataSource = dt Dim ts As New DataGridTableStyle ts.MappingName = "Pieter" Dim column As New DataGridTextBoxColumn ts.GridColumnStyles.Add(column) DataGrid1.TableStyles.Add(ts) column.MappingName = "Time" column.HeaderText = "Tijd" column.Width = 50 column.Format = ("HH:mm:ss") End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Timer1.Tick For i As Integer = 0 To 20 Dim dr As DataRow = dt.NewRow dr(0) = Now dt.Rows.Add(dr) DataGrid1.ScrollToRow(dt.Rows.Count - 1) Next End Sub End Class Public Class MyDataGrid Inherits DataGrid Sub ScrollToRow(ByVal row As Integer) If Not Me.DataSource Is Nothing Then Me.GridVScrolled(Me, _ New ScrollEventArgs(ScrollEventType.LargeIncrement, row)) End If End Sub End Class This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jason |
last post by:
Is there a way to do this after you have bound it? I am just wanting to add
another record that will be displayed.
|
by: Rick |
last post by:
Hello all, I hope all is well with you.
I am having a seriously difficult time with this problem. Allow me to
set
up the problem.
I have a System.Web.UI.Page with the following controls...
|
by: Pat |
last post by:
All,
I wrote a front end of a sql submitter for lack of better words.
Simply I am passing in a query ( strSQL ) built in a text box on the
client screen.
If it runs, I bind the data to a...
|
by: Marty |
last post by:
I have a numeric Oracle field which stores -1 for true and 0 for
false. I am trying to populate a checkbox in a datagrid. In my SQL
statement, I used the Decode function so that when it populates...
|
by: Alex |
last post by:
I'm wondering how I can add data to the datakey property of the DataGrid.
It seems to be read only. How can I populate it?
I'm using data bound columns, however do not autogenerate the entire grid...
|
by: Garry Newman |
last post by:
How can I manually sort elements in my datagrid as .NET
places them in alphabetical order ?
G.N
|
by: DraguVaso |
last post by:
Hi,
I have a DataGrid to which I want the program add from time to time a new
row, without redrawing the whole DataGrid. So I don't want to add the new
Row to the DataSource and than do a...
|
by: Agnes |
last post by:
I got a Master-Detail relationship. Branch with dept (two tables) , as the
user input the Dept code, press 'Confirm' button,
I will select * from branch and input into the datatable mannually. the...
|
by: joelranck |
last post by:
I'm having a problem figuring out how to evaluate a value read from a
SqlConnection and then assign a column based on that evaluation into my
DataGrid. Basically when the DB is queried I want to...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |