TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ruben laureys
NA
4
0
datagridview scrolling problem
Mar 18 2010 8:36 AM
I have a form with a datagridview to which rows are being added at runtime (data that comes in, about one row per second at this time, will become much more). There is no problem as long as the number of rows fits the size of the datagridview. When the data doesn't fit the datagridview, a vertical scrollbar appears. When I attempt to scroll, the application hangs.
I've tried stopping the dataflow, and then scrolling but this gives the same problem.
Also the scrollbar arrows are not drawn.
public
partial
class
SnifferPanel : UserControl
{
public
bool
running =
false
;
DataTable d;
public
SnifferPanel()
{
d =
new
DataTable();
d.Columns.Add(
"Source"
);
d.Columns.Add(
"Destination"
);
d.Columns.Add(
"UID"
);
d.Columns.Add(
"Index"
);
d.Columns.Add(
"Mode"
);
d.Columns.Add(
"Data"
);
InitializeComponent();
BindingSource b =
new
BindingSource();
b.DataSource = d;
dataGridViewSniffer.DataSource = b;
}
public
void
newData(Emulator.Modulemanager.RS485Data data)
{
if
(running)
{
dataGridViewSniffer.SuspendLayout();
string
[] da = { data.Address, data.Address, data.Uid, data.Index, data.Mode, data.Data };
d.Rows.Add(da);
dataGridViewSniffer.ResumeLayout();
}
}
}
The newData function is called from a class that handles the incoming data, this class runs in a seperate thread.
I hope someone here can help me out.
edit: Wow, my code looks horrible. Can anyone tell me how to properly align code on the forum?
Reply
Answers (
3
)
how?
action under Button press!