Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Am I doing the resource access wrong
Message
De
19/07/2007 16:32:24
 
 
À
19/07/2007 15:40:32
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01241787
Message ID:
01242142
Vues:
24
>DataGridViewCell cell = myDataGridView["myColumnToCheck", e.RowIndex];
>DataGridViewRow row = myDataGridView.Rows[e.RowIndex];
Hi Cetin

Hmmm... I'll have to look at this more after work, but this seems to give me a DataGridViewRow with the same fields (cells) as my DataGridView.

I need to access the DataSet.DataTable[SameRecordAsViewing].Field i.e. cdsMessageDataSet.Messages[iRow].msgtype

The DataSet is connected to the DataGridView via a BindingSource "messagesBindingSource"

The msgtype field does not exist in the DataGridView.

I could probably work around this by creating a hidden column in the DataGridView, but I just assumed that since the DataSet needs to be able to be updated there would be an easy way to link back from the current row in the DataGridView to the source record in the DataSet.DataTable

In VFP I frequently access fields that are not being displayed in the current grid for things like formatting and calculating column values. Since VFP moves the record pointer in the source table this is easy to do. Just trying to figure out how to implement the same functionality here.
>>    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;
>>          }
>>        }
>>      }
>>
>>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