How to make multiple datagrid rows invisible??

N

Nader

It's easy to make the last row in a datagrid (filled with a table)
invisible:
datagridObject.Rows.Visible = false

BUT if 'i' is not the last row then things go wrong.

I even tried:

for (int i = datagridObject.Rows.Count - 1; i >= 0; i-- )
{
dgrDeelleveringen.Rows.Visible = false;
}

And it doesn't want to work.

Someone please HELP
 
N

Nader

As long as it's the last Row it makes it invisible but whene the next
Row comes it gives an exception.



ChrisM schreef:
What actually goes wrong?

Cheers,

Chris.

Nader said:
It's easy to make the last row in a datagrid (filled with a table)
invisible:
datagridObject.Rows.Visible = false

BUT if 'i' is not the last row then things go wrong.

I even tried:

for (int i = datagridObject.Rows.Count - 1; i >= 0; i-- )
{
dgrDeelleveringen.Rows.Visible = false;
}

And it doesn't want to work.

Someone please HELP
 
C

ChrisM

Ok,

So what is the exception that it gives?

Nader said:
As long as it's the last Row it makes it invisible but whene the next
Row comes it gives an exception.



ChrisM schreef:
What actually goes wrong?

Cheers,

Chris.

Nader said:
It's easy to make the last row in a datagrid (filled with a table)
invisible:
datagridObject.Rows.Visible = false

BUT if 'i' is not the last row then things go wrong.

I even tried:

for (int i = datagridObject.Rows.Count - 1; i >= 0; i-- )
{
dgrDeelleveringen.Rows.Visible = false;
}

And it doesn't want to work.

Someone please HELP

 
N

Nader

Chris, Hier you are:

System.InvalidOperationException was unhandeld
Row associated with the currency manager's position cannot be made
invisible.

And hier the explanation:
An InvalidOperationException exception is thrown in cases when the
failure to invoke a method is caused by a reason other than an invalid
argument. This may be thrown by .NET Framework methods when the
underlying Win32 method cannot be invoked.

I hope that this says more to you then to me :)



ChrisM schreef:
Ok,

So what is the exception that it gives?

Nader said:
As long as it's the last Row it makes it invisible but whene the next
Row comes it gives an exception.



ChrisM schreef:
What actually goes wrong?

Cheers,

Chris.

It's easy to make the last row in a datagrid (filled with a table)
invisible:
datagridObject.Rows.Visible = false

BUT if 'i' is not the last row then things go wrong.

I even tried:

for (int i = datagridObject.Rows.Count - 1; i >= 0; i-- )
{
dgrDeelleveringen.Rows.Visible = false;
}

And it doesn't want to work.

Someone please HELP

 
C

ChrisM

I'm partially guessing here, but it seems to be saying that you cannot make
the currently selected row invisible, or more specifially the row that the
pointer is currently on.

You could try using

dgrDeelleveringen.CurrentRowIndex = x;

Before your loop that sets the visible property.

Where x is a row that you ARE NOT going to make hidden.

From what it seems to be saying, I don't think it's possible to hide ALL the
rows in the table...(?)
You will have to leave at least one row visible (the row the CurrentRowIndex
needs to be pointing at).

HTH??

Chris.

Nader said:
Chris, Hier you are:

System.InvalidOperationException was unhandeld
Row associated with the currency manager's position cannot be made
invisible.

And hier the explanation:
An InvalidOperationException exception is thrown in cases when the
failure to invoke a method is caused by a reason other than an invalid
argument. This may be thrown by .NET Framework methods when the
underlying Win32 method cannot be invoked.

I hope that this says more to you then to me :)



ChrisM schreef:
Ok,

So what is the exception that it gives?

Nader said:
As long as it's the last Row it makes it invisible but whene the next
Row comes it gives an exception.



ChrisM schreef:

What actually goes wrong?

Cheers,

Chris.

It's easy to make the last row in a datagrid (filled with a table)
invisible:
datagridObject.Rows.Visible = false

BUT if 'i' is not the last row then things go wrong.

I even tried:

for (int i = datagridObject.Rows.Count - 1; i >= 0; i-- )
{
dgrDeelleveringen.Rows.Visible = false;
}

And it doesn't want to work.

Someone please HELP

 
N

Nader

Thanks a lot Chris,
You seem to be a guru ;)


ChrisM schreef:
I'm partially guessing here, but it seems to be saying that you cannot make
the currently selected row invisible, or more specifially the row that the
pointer is currently on.

You could try using

dgrDeelleveringen.CurrentRowIndex = x;

Before your loop that sets the visible property.

Where x is a row that you ARE NOT going to make hidden.

From what it seems to be saying, I don't think it's possible to hide ALL the
rows in the table...(?)
You will have to leave at least one row visible (the row the CurrentRowIndex
needs to be pointing at).

HTH??

Chris.

Nader said:
Chris, Hier you are:

System.InvalidOperationException was unhandeld
Row associated with the currency manager's position cannot be made
invisible.

And hier the explanation:
An InvalidOperationException exception is thrown in cases when the
failure to invoke a method is caused by a reason other than an invalid
argument. This may be thrown by .NET Framework methods when the
underlying Win32 method cannot be invoked.

I hope that this says more to you then to me :)



ChrisM schreef:
Ok,

So what is the exception that it gives?

As long as it's the last Row it makes it invisible but whene the next
Row comes it gives an exception.



ChrisM schreef:

What actually goes wrong?

Cheers,

Chris.

It's easy to make the last row in a datagrid (filled with a table)
invisible:
datagridObject.Rows.Visible = false

BUT if 'i' is not the last row then things go wrong.

I even tried:

for (int i = datagridObject.Rows.Count - 1; i >= 0; i-- )
{
dgrDeelleveringen.Rows.Visible = false;
}

And it doesn't want to work.

Someone please HELP

 
C

ChrisM

Heh!
Wish I was. Just had a quite few run-ins with the DataGrid. The application
I spend most of my time developing/supporting uses it a lot... and I still
hate it(the datagrid, not my application).
So hard to make it do the simplest of tasks most of the time...

Chris.

Nader said:
Thanks a lot Chris,
You seem to be a guru ;)


ChrisM schreef:
I'm partially guessing here, but it seems to be saying that you cannot
make
the currently selected row invisible, or more specifially the row that
the
pointer is currently on.

You could try using

dgrDeelleveringen.CurrentRowIndex = x;

Before your loop that sets the visible property.

Where x is a row that you ARE NOT going to make hidden.

From what it seems to be saying, I don't think it's possible to hide ALL
the
rows in the table...(?)
You will have to leave at least one row visible (the row the
CurrentRowIndex
needs to be pointing at).

HTH??

Chris.

Nader said:
Chris, Hier you are:

System.InvalidOperationException was unhandeld
Row associated with the currency manager's position cannot be made
invisible.

And hier the explanation:
An InvalidOperationException exception is thrown in cases when the
failure to invoke a method is caused by a reason other than an invalid
argument. This may be thrown by .NET Framework methods when the
underlying Win32 method cannot be invoked.

I hope that this says more to you then to me :)



ChrisM schreef:

Ok,

So what is the exception that it gives?

As long as it's the last Row it makes it invisible but whene the
next
Row comes it gives an exception.



ChrisM schreef:

What actually goes wrong?

Cheers,

Chris.

It's easy to make the last row in a datagrid (filled with a
table)
invisible:
datagridObject.Rows.Visible = false

BUT if 'i' is not the last row then things go wrong.

I even tried:

for (int i = datagridObject.Rows.Count - 1; i >= 0; i-- )
{
dgrDeelleveringen.Rows.Visible = false;
}

And it doesn't want to work.

Someone please HELP

 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top