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
Kanhialal kk
NA
234
339.3k
Cross-thread operation not valid: Control 'dateTimePicker1' accessed from a thread other than the thread it was created on.
Apr 29 2011 5:45 AM
Hi...
I am working on desktop application.
I want to search multiple records in
AxMSFlexGridLib
but following error is happening..
Cross-thread operation not valid: Control 'dateTimePicker1' accessed from a thread other than the thread it was created on.
below is code.
public void SearchCode_Method()
{
this.flex1.set_ColWidth(0, 0x177);
this.flex1.set_ColWidth(1, 0x3e8);
this.flex1.set_ColWidth(2, 0x9c4);
this.flex1.set_ColWidth(3, 800);
this.flex1.set_ColWidth(4, 600);
this.flex1.set_ColWidth(5, 0x44c);
this.flex1.set_ColWidth(6, 0x44c);
this.flex1.set_ColWidth(7, 0x3e8);
this.flex1.set_TextMatrix(0, 0, "S#");
this.flex1.set_TextMatrix(0, 1, "CCode");
this.flex1.set_TextMatrix(0, 2, "Name");
this.flex1.set_TextMatrix(0, 3, "Invoice#");
this.flex1.set_TextMatrix(0, 4, "Qty");
this.flex1.set_TextMatrix(0, 5, "Bkg Date");
this.flex1.set_TextMatrix(0, 6, "Dlv Date");
this.flex1.set_TextMatrix(0, 7, "Amount");
this.flex1.set_ColAlignment(1, 5);
this.flex1.set_ColAlignment(3, 5);
this.flex1.set_ColAlignment(4, 5);
this.flex1.set_ColAlignment(5, 5);
this.flex1.set_ColAlignment(6, 5);
this.flex1.set_ColAlignment(7, 5);
this.colno = 3;
if (this.deliverd)
{
this.table = this.dsdata.Tables[6];
}
else if (this.nondelivered)
{
this.table = this.dsdata.Tables[7];
}
else
{
this.table = this.dsdata.Tables[3];
}
int num2 = 1;
int num3 = 1;
foreach (DataRow row in this.table.Rows)
{
if (num3 >= this.flex1.Rows)
{
this.flex1.Rows++;
this.flex1.set_ColWidth(7, 750);
}
this.flex1.set_TextMatrix(num2, 1, Convert.ToString(row["CCode"]));
this.flex1.set_TextMatrix(num2, 2, Convert.ToString(row["Name"]));
this.flex1.set_TextMatrix(num2, 3, Convert.ToString(row["InvoiceNo"]));
this.dateTimePicker1.Text = Convert.ToString(row["BookingDate"]);
this.flex1.set_TextMatrix(num2, 5, this.dateTimePicker1.Value.ToShortDateString());
this.dateTimePicker1.Text = Convert.ToString(row["DeliveryDate"]);
this.flex1.set_TextMatrix(num2, 6, this.dateTimePicker1.Value.ToShortDateString());
foreach (DataRow row2 in this.dsdata.Tables[0].Rows)
{
if (row["Invoiceno"].ToString() == row2["InvoiceNo"].ToString())
{
this.flex1.set_TextMatrix(num2, 4, Convert.ToString(row2["Quantity"]));
this.flex1.set_TextMatrix(num2, 7, Convert.ToString(row2["Amount"]));
}
}
num3++;
num2++;
}
for (int i = 1; i < num3; i++)
{
this.flex1.set_TextMatrix(i, 0, Convert.ToString(i));
}
this.searchDataset(this.table, this.dsdata.Tables[0], "CCode");
this.btnPrint.Enabled = true;
this.lblnote.Text = "";
}
in above code where exception is happening I did that bold..
any body help me..
Reply
Answers (
3
)
Pop Up window opens and closes immediately
To read the page count of a zipped PDF file