Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Am I doing the resource access wrong
Message
De
19/07/2007 15:03:19
 
 
À
19/07/2007 13:28:27
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01241787
Message ID:
01242106
Vues:
21
Having solved that problem... I can now see that my fear about cdsMessageDataSet.Messages[iRow].msgtype not working correctly after a sort ect was well founded.
    private void OnDataGridViewCellFormat(object sender, DataGridViewCellFormattingEventArgs e)
      {
      if (this.dataGridView.Columns[e.ColumnIndex].Name == "imgType")
        {
        Assembly a = Assembly.GetExecutingAssembly();
        // get a list of resource names from the manifest
        //string[] resNames = a.GetManifestResourceNames();

        int iRow = e.RowIndex;
        if (cdsMessageDataSet.Messages[iRow].msgtype == "E")
          {
          e.Value = Bitmap.FromStream(a.GetManifestResourceStream("cdsProCS.Resources.Work.bmp")) as Bitmap;
          }
        else
          {
          e.Value = Bitmap.FromStream(a.GetManifestResourceStream("cdsProCS.Resources.PhoneCall.bmp")) as Bitmap;
          }
        }
      }
I have also tried:
DataRowView dv = cdsMessageDataSet.Messages.DefaultView[iRow];
if (dv["msgtype"].ToString() == "E")
To no avail.

Once the DataGridView is sorted, both methods point to the wrong record.

So I'm back to one of my earlier questions...

How do I access the current record in the DataSet.DataTable for the current row of a DataGridView?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform