Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Am I doing the resource access wrong
Message
From
19/07/2007 15:40:32
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
19/07/2007 15:03:19
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01241787
Message ID:
01242115
Views:
17
>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?
DataGridViewCell cell = myDataGridView["myColumnToCheck", e.RowIndex];
DataGridViewRow row = myDataGridView.Rows[e.RowIndex];
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform