|
musefan wrote: I mean a table you put at the side of your bed - Call it what you will
Well why didn't you say so.
A Call it what you will Table.
Using the correct names for Controls/Classes, can make the difference between getting an answer and getting the bird!!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Can anyone give advice on how to do this?
I am using a DeveloperExpress Grid linked to a BindingSource.
I import data into the bindingsource from a flat file then perform various checks to ensure the data is valid. If not, I set a column error for the row - as follows...
if (view.GetRowCellValue(intRow, "intX") == null || Convert.ToDouble(view.GetRowCellValue(intRow, "intX")) == (double)0.00)
{
dr.SetColumnError("intX", String.Format("{0}: Missing value.", view.Columns["intX"].Caption));
}
I have a button on the form to allow the user to filter the grid so that the grid will hide all valid rows to allow them to concentrate on fixing the invalid rows.
Can someone tell me how to apply a filter to the binding source to only show those rows with one or more column errors?
Many Thanks
|
|
|
|
|
Something like:
bindingSource1.Filter = "intX == null || intX == 0.00";
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Henry, Thanks for the reply.
I realise I can do that - the problem I have is that there is far more to the error checking than the small snippet I posted and it will not be feasible to do it this way. I could put in a dummy column and set the value to 1 within my error checking code on finding an error and filter on the dummy column = 1. However, I was hoping there was some way I could get a collection of the rows containing an error and use that to filter eg = extract all the ids of the rows with one or more errors into an array then convert that into a filter string... ID = id1 or ID = ID2...
|
|
|
|
|
Well in a .NET DataGridView you could iterate over the DataGridRowCollection and do that. I would assume the DevExpress version has the same functionality. Whether that is practical depends on the number of rows involved, from a time point of view.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi Henry - that's the approach I've now gone for...
string strFilterString = "";
sp00134BindingSource.Filter = ""; // Clear any Prior Filter //
foreach (DataRow dr in this.dataSet_AT.sp00134.Rows)
{
if (dr.HasErrors) strFilterString += " or ID = '" + dr["ID"].ToString() + "'" ?? String.Empty;
}
if (strFilterString.Length > 4) strFilterString = strFilterString.Remove(0, 4); // Remove initial " or " clause //
if (strFilterString == String.Empty) return;
try
{
sp00134BindingSource.Filter = strFilterString;
}
catch (Exception Ex)
{ .....
Thanks for the pointer.
|
|
|
|
|
Hi!
i am adding rows to a datagridView with two columns, all my rows will be displayed as a long list, instead I want it to for example when ten rows has been added I want the next row to be inserted side by side to the first one.
Thanks,
Mjelten
Edit:
to make it clearer:
1---------------- 10---------------------
2---------------- 11---------------------
3---------------- 12---------------------
this is the structure..
modified on Tuesday, June 2, 2009 8:25 AM
|
|
|
|
|
Add a new column after adding every 10 rows.
"Do first things first, and second things not at all."
— Peter Drucker.
|
|
|
|
|
that doesent work, beacuse I have tagged every row, with a variable..
|
|
|
|
|
The DataGridView is probably not the best control to use for this then. Consider something like a Repeater where you can specify the number of horizontal columns
only two letters away from being an asset
|
|
|
|
|
i thought that, but you do not think there is a way to get around it?
|
|
|
|
|
The way to get around it is to use the proper tools for the job.
only two letters away from being an asset
|
|
|
|
|
probably, but sometimes the time for doing the best solution is to long... i have to change a lot if I am going for a differnt dataholoder....
|
|
|
|
|
Depending on the layout of your form, and how you access the data, you could possibly make your own control, inheriting from DataGridView with the appropriate columns configured, and then create a new control every 6 (or whatever the number was) records. Complicated to keep track of though and could involve large numbers of controls.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
And how is adding time and complexity a solution?
only two letters away from being an asset
|
|
|
|
|
I didn't say it was optimal. Simply that it was an approach. Sometimes when you're stuck, even a wrong answer can prompt you into getting it.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thanks, I have to think about that. I will probably go with changing the structure of my solution, because i am trying to use datagrudview in a way that it should not be used.
|
|
|
|
|
Always time to do it over but never time to do it right.
mjelten wrote: i have to change a lot if I am going for a differnt dataholoder
Then it probably wasn't architected well enough in the first place. You should be able to change the presentation without affecting that much. But anyway, good luck
only two letters away from being an asset
|
|
|
|
|
I agree, but the mistake is already made
|
|
|
|
|
|
vahidha wrote: I need java code for that purpose
And you are asking for that in a C# forum???
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
A few points.
vahidha wrote: Its very urgent..
Not for me it isn't. I couldn't care less.
vahidha wrote: I need java code for that purpose
If you can't tell the difference between C# and Java, you're not even qualified to stuff envelopes for a living.
vahidha wrote: I need java code
This isn't rentacoder - we don't write your code for you here. We expect you to get off your lazy ass and write it yourself. We'll help if you get stuck, but as we don't get your pay check, we don't do your job.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
this your code
try
{
if (!question.ToUpper().Contains("C#")){
throw new WrongForumException("You are in wrong forum.");
}
if (question.ToUpper().Contains("URGENT")){
throw new NotYourSlaveException("We are not your slave dud.");
}
SomeBodyWillTryToAnswerYourQuestion();
}
catch (Exception ex)
{
Console.WriteLine("Nice try, but "+ ex.Message +" raised");
}
hope it will open your mind.
dhaim
ing ngarso sung tulodho, ing madyo mangun karso, tut wuri handayani. "Ki Hajar Dewantoro"
in the front line gave a lead, in the middle line build goodwill, in the behind give power support
|
|
|
|
|
Not to be pedantic but you really shouldn't swallow exceptions. If you are going to swallow the exceptions then you probably don't need to throw them. An if statement is way more appropriate.
|
|
|
|
|
can anyone please tell how can i put multiple forecolors for my text in one textboxx only in c#. thanks in advance.
|
|
|
|