DataGridView daily problems...

i have a DataGridview with some ComboBox cells in there.

each row should have a different list of items to select the value from.

you can set the bindingsource on Enter and reset the bindingsource to the list with all items on EndEdit...


in dataGridView CellEnter
if (e.ColumnIndex == CELLINDEXWhereComboBoxIs) { //Set DataSource of cell if comboBoxCell DataGridViewComboBoxCell cell = (DataGridViewComboBoxCell)dataGridView[e.ColumnIndex, e.RowIndex]; cell.DataSource = bindingSourceFiltered; }

in dataGridView CellEndEdit

if (e.ColumnIndex == CELLINDEXWhereComboBoxIs) { //set DataSource to BindingSource with all items DataGridViewComboBoxCell cell = (DataGridViewComboBoxCell)dataGridView[e.ColumnIndex, e.RowIndex]; cell.DataSource = bindingSourceAll; }


ps:
you can add filters to the bindingsource!
but only if the underlying list supports filtering!!

Data driven unit tests with Text Files!!

i wanted to do unit tests with a text file as input
1 line contains: entity serialized as string, entityName and other parameter

e.g.
1|12|123123,123123,143123|54| Riga1_GPS true

line is delimited by tab

#1
create file in your test project
righevalid.txt
File Properties: --> Copy to Output Directory --> copy always

#2
create file in your test project
schema.ini
File Properties: --> Copy to Output Directory --> copy always

#3
content of schema.ini
[righevalid.txt] Format=TabDelimited


#4
create testmethod

#5
add following attributes to testmethod
[TestMethod()] [DeploymentItem(@"righevalid.txt")] [DeploymentItem(@"schema.ini")] [DataSource("System.Data.OleDb", @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=.;Extended Properties='text;FMT=TabDelimited;HDR=YES'", @"righevalid.txt", DataAccessMethod.Sequential)] public void LoadValidRigaTest() { } Note DeploymentItem copies files to Test Run Directory

DataSource is a special OleDb Usage with txt Files


#6
use TestContext.DataRow[index] to access your single columns (line) of the text file
TestContext.DataRow[0] = col1 and so on


#7
Run Test


#8
see output Passed or Failed
Doubleclick Result you can see the result of the single lines!

GREAT!

TinyMce with webeditor Control IN ACTION

Control hosted in Winforms Application:




Control in Editmode - new Form ShowDialog

Transactions with MSAccess mdb File

If you use Distributed Transactions within your Application and an Access .mdb a DataContainer then you maybe did get this:

System.InvalidOperationException: The ITransactionLocal interface is not supported by the 'Microsoft.Jet.OLEDB.4.0' provider.  Local transactions are unavailable with the current provider.

SOLUTION:
Don't let Access participate in this Distributed Transaction
System.Transactions.TransactionScopeOption.Suppress


Msdn Link: Supporting Transactions in OLE DB

Entreprise Library: Exception Handling Policies

wir sind gerade bei der migration von Microsoft Oracle Client nach Oracle Data Provider.


WICHTIG in app.config
wenn man bei 2 exceptionTypes einfügt, greifen diese Regeln nicht!

weiss nicht wieso.
aber mit nur einer funzts.
wenn beide exceptionTypes drin sind, werden diese nicht abgehandlet.

KOMISCH

  <exceptionHandling>
    <exceptionPolicies>
      <add name="Global Policy">
        <exceptionTypes>
          <add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" postHandlingAction="NotifyRethrow" name="Exception" />
        </exceptionTypes>
      </add>
      <add name="DataAccess">
        <exceptionTypes>
          <add type="Oracle.DataAccess.Client.OracleException, Oracle.DataAccess, Version=1.102.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342" postHandlingAction="ThrowNewException" name="OracleException">
            <exceptionHandlers>
              <add type="Siag.DataAccess.ExceptionHandler.OracleODPExceptionHandler, Siag.DataAccess" name="Custom Handler" />
            </exceptionHandlers>
          </add>
    
     <!-- <add type="System.Data.OracleClient.OracleException, System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" postHandlingAction="ThrowNewException" name="OracleException">
            <exceptionHandlers>
              <add type="Siag.DataAccess.ExceptionHandler.OracleExceptionHandler, Siag.DataAccess, Version=2.0.0.11969, Culture=neutral, PublicKeyToken=null" name="Custom Handler"/>
            </exceptionHandlers>
          </add>
          -->

        </exceptionTypes>
      </add>
    </exceptionPolicies>
  </exceptionHandling>

Latest Posts

Popular Posts