RED X (cross) on datagridview

  • Thread starter Thread starter Guest
  • Start date Start date
Hi,

To address this problem more effeciently, I'd like to ask two questions:

1. Do you see the red X on the DataGridView at design time or run time?
2. Could you please tell us how to reproduce the problem?

I look forwad to your reply!

Sincerely,
Linda Liu
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
1) I see the red cross at run time
2) I have a datagridview and i popultae it with a sql table every 2 minutes:


Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
BackgroundWorker1.RunWorkerAsync()
end sub

Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal
e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Me.DataGridView1.DataSource = riempifax()
End Sub

Public Function riempifax() As DataTable

Dim connstring As String = "Data Source=www.hacpack.it;Initial
Catalog=hacpack;User id=HACPACK;Password=francesca"
Dim conn As New SqlConnection((connstring))
conn.Open()
Dim dataSet1 As New DataSet("FAX")
Dim dataAdapter As New SqlDataAdapter()
dataAdapter.SelectCommand = New SqlCommand("SELECT * FROM [FAX]
where [in elaborazione]='0' AND [rifiutata]='0'", conn)
dataAdapter.Fill(dataSet1, "FAX")

Return dataSet1.Tables(0)

End Function
 
Hi,

Thank you for your reply and sample code!

I performed a test based on your description but didn't reproduce the
problem on my side. I create a WinForm application project and add a
DataGridView, a BackgroundWorker and a Timer on the form. The following is
the code in the form.

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.timer1.Tick += new EventHandler(timer1_Tick);
this.backgroundWorker1.DoWork += new
DoWorkEventHandler(backgroundWorker1_DoWork);
this.backgroundWorker1.RunWorkerCompleted += new
RunWorkerCompletedEventHandler(backgroundWorker1_RunWorkerCompleted);
}

void timer1_Tick(object sender, EventArgs e)
{
this.backgroundWorker1.RunWorkerAsync();
}

void backgroundWorker1_RunWorkerCompleted(object sender,
RunWorkerCompletedEventArgs e)
{
this.dataGridView1.DataSource = e.Result;
}

void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
e.Result = FillData();
}
private DataTable FillData()
{
SqlConnection conn = new SqlConnection("data
source=.\\sqlexpress; Initial Catalog=TestDataBase; Integrated
Security=true");
SqlDataAdapter da = new SqlDataAdapter("select * from student",
conn);
DataSet ds = new DataSet();
da.Fill(ds, "Student");
return ds.Tables["Student"];
}

private void Form1_Load(object sender, EventArgs e)
{
this.timer1.Interval = 2000;
this.timer1.Start();
}
}

Since I couldn't reproduce the problem on my side, there's other reasons
that cause the problem. Please try to break down your project and reproduce
the problem in a simple project.

I look forward to your reply!

Sincerely,
Linda Liu
Microsoft Online Community Support
 
Back
Top