473,473 Members | 1,482 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problems with IEnumerator: Enumerator is not started Exception

1 New Member
Problems come when i added few table styles into DataGridTableStyle Collection and then trying to get the current TableStyle.
On first, ecxcuting this code
Expand|Select|Wrap|Line Numbers
  1.             dgEmployees.DataSource = null; //DataGrid
  2.             dgProjects.DataSource = null;
  3.             dgEmployees.DataSource = DS;
  4.             dgProjects.DataSource = DS;
  5.             dgEmployees.TableStyles.Clear();
  6.             int E_index = dgEmployees.TableStyles.Add(new DataGridTableStyle());
  7.             dgEmployees.TableStyles[E_index].MappingName = "EmployeeTable";
  8.             dgProjects.TableStyles.Clear();
  9.             int P_index = dgProjects.TableStyles.Add(new DataGridTableStyle());
  10.             dgProjects.TableStyles[P_index].MappingName = "ProjectTable";
Then i trying to get the DataTable, on what current table style mapped to, in this code:
Expand|Select|Wrap|Line Numbers
  1.             try
  2.                     {
  3.  
  4.                         if (Table.TableStyles.Count > 0)
  5.                         {
  6.                             System.Collections.IEnumerator MuEnum = Table.TableStyles.GetEnumerator(); 
  7.                             MappingName = ((DataGridTableStyle)MuEnum.Current).MappingName;
  8.                         }
  9.                         else
  10.                             MappingName = "No table Styles";
  11.  
  12.                     }
  13.                     catch(Exception err)
  14.                     {
  15.                         MappingName = "Unknown - errors at trying to use table styles.\n" + err.Message +
  16.                             "\nStyles in table - " + dgEmployees.TableStyles.Count.ToString();
  17.                     }
How can I get current TableStyle?
Sep 21 '07 #1
2 1322
JosAH
11,448 Recognized Expert MVP
You should've posted your question in the .NET forum section, not in the .NET
articles section; I'll move your question over to the forum.

kind regards,

Jos
Sep 21 '07 #2
Plater
7,872 Recognized Expert Expert
Generally with Enumerators,
You have to call the .Next() or something on them before using it because it starts on a blank spot "before" the first entry.

I think.
Sep 21 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Sasha | last post by:
Hi, I am extending standard IEnumerator, and I was just wondering what is the best way to make enumarator safe? What do I mean by safe? Detect deletes and all... My idea is to have private Guid...
3
by: Hans | last post by:
I implemented the IEnumerator interface in some classes to enable the use of the foreach statement. As you probalbly know, the interface asks for the implementation of object IEnumerator.Curren...
2
by: Pavils Jurjans | last post by:
Hello, please consider the code at the end of this posting, that depicts simple case of custom enumerator. This particular example will enumerate over list of random number within 1..10, and will...
1
by: Matthias S. | last post by:
Hi, I'm trying to provide the user of my class access to the objects in a collection without allowing him to modify (add/remove/clear items) the collection. I thought I can do it by providing a...
6
by: Mike | last post by:
I'm using VS2005 beta 2. (1) It looks like "foreach" is looking for an IEnumerable only, and not an IEnumerator. That means that class I use in the interation has to have GetEnumerator(),...
2
by: wvtempl | last post by:
From the documentation in MSDN, it looks as though the following should iterate through the collection twice. However, MoveNext in the second iteration returns false: Dim oList As New List(Of...
11
by: Leslie Sanford | last post by:
I've been kicking around an idea mostly as a thought experiment at this point. The idea is to create a thread safe collection that implements the IEnumerable interface. The enumerators it creates...
3
by: cody | last post by:
Currently it is only legal to use types which has a method named GetEnumerator to be used in a foreach loop. This makes it impossible to use the same Enumerator after and before a foreach loop,...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.