Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1800
Wingrid and windows form instances
posted

Hi,

I have an interesting scenario. I have a wingrid that displays records based on a search by the user with outlook groupby feature enabled. From the grid on double clicking a row i'm showing the details of the record in a windows form. I'm opening as a new form and not as a show dialog.

When the user double clicks the same row anytime.,i should not create another instance of the form, but i have to show the already opened instance. So if the instance is available i have to open the instance else i have to create a new instance.

To do this., i declared array of objects and resized the array with the row count of the grid. This is where the problem starts. I would pass the row index and open the instances like this.,

Array.Resize(ref obj, Grid.Rows.Count)

rowID = e.Row.Index;   

obj[rowId] = new frmDetailsForm();

 

When the user clicks again the same row., i'll check for the available instance.

 

if(obj[rowID].IsDisposed !=true)

and show the existing window opened, else create a new instance.

Now., when there is a groupby in the grid, the row count is only groupby row count and i tend to miss the actual row count in the grid. My questions are,

1. How to track the available instances? (Might not be related to Ultragrid, still wanna clarify myself)

2. How to get the row index after the groupby is performed?

Thanks.,