|
At the moment I can not see any reason why your DatabindingComplete handler doesn't fire. I will continue to look at that though.
Even if that was working there are two lines in the code that you posted which are contradictory and may cause problems.
grid.Columns[5].AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader;
<big>grid.Columns[5].ValueType = typeof(decimal);</big>
datas[item.Kundetype.Type].Rows.Add(item.KundeNavn, tilmeldte, ikketilmeldt, særaftale, tilmeldte + ikketilmeldt, <big>procent.ToString("###")</big>);
In the first block you are setting the ValueType to Decimal and yet in the second you are filling it with a string procent.ToString("###") . This is incompatible.
It might be better to modify the last one to simply use the result of your percentage calculation and take care of the displayed data by using the CellFormatting event of the DataGridView
Like this:
datas[item.Kundetype.Type].Rows.Add(item.KundeNavn, tilmeldte, ikketilmeldt, særaftale, tilmeldte + ikketilmeldt, procent);
with the CellFormatting handler something like this:
private void grid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if ((e.Value == DBNull.Value) || (e.Value == null))
{
return;
}
if (this.dataGridView1.Columns[e.ColumnIndex].Name == "nummer6")
{
string nummer6Format = e.Value.ToString("###") + " %";
e.Value = unitPriceFormat;
e.FormattingApplied = true;
}
}
This way you get to keep a numeric value in the DataGridViewCell/Column, much easier to deal with for comparisons, whilst displaying a prettified version, much easier for humans to deal with.
If the DataFormattingComplete ever works you can then use your
if ((<big>decimal</big>)cell.Value < 70)
{
row.DefaultCellStyle.BackColor = Color.LightPink;
}
with more confidence.
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.”
Why do programmers often confuse Halloween and Christmas? - Because 31 Oct = 25 Dec.
Business Myths of the Geek #4 'What you think matters.'
|
|
|
|
|
Thnx a lot. I still havn't got it working yet... I'm kinda affraid that its because the dataGridView is "coded" and not drag n' drop'ed... Its just annoying to start over with code who seems too work as they are, but just not when you want this new feature. Its one of my old partners who developed the code, which is why I ain't 100% confident with it yet.
If you find an answer why my event ain't triggered, plz let me know (note that this win form has a TabControl and 3 TabPages).
|
|
|
|
|
We have a utility that we use for analysing log files created by our app.
As it works currently, there is a list of log items and based on a filter [not important] we want to display them.
I use a string builder to populate a rich text box, something like this:
StringBuilder sb = new sb();
foreach (LogItem item in logFile)
{
if (item.Show(filter))
{
sb.Append(item.FullDescription);
}
}
rtf.Text = sb.ToString();
}
I now need a bit more than just text. I'm thinking along the lines of using some rtf markup (can I?) to annotate the text so that when the user clicks on somewhere in the displayed text, I can retrieve the message number. This is to support some extended things[tm] where I need access to the underlying item from the file.
I'm using rtf so that we can copy the text easily into other documents and I don't really want to loose that ability. It may also be worth noting that some of these files can get rather large ~200MB and the displayed text gets rebuilt regularly - or with a bit of fudging it could be amended.
Any help and I'll send you a free badger!
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
|
|
|
|
|
I was going to help till you mentioned the badger!
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
Don't even think about it!
Anyone trying to show a 200MB file in one chunk is looking for unhappy users.
Think about it. There is a log you need to look at. Through the use of very clever code, it loads immediately (Oh look! Flying Bacon! And it's flossing!), and when it does you can scroll through looking for the bit you want. Shouldn't take you more than a week or so...
Page it in. Provide search facilities, save facilities, and filters. Don't even think of loading it into a RTB unless there is less than 100 lines - and even then, try to cut it down. Think about using a DataGridView, or a TreeView instead - be nice to the poor user!
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
OriginalGriff wrote: Provide search facilities [...] filters
Already has it.
The file is loaded, but not displayed and the user [that's me] selects which items to display [not important].
I might have '000s of items but I'll only be displaying a few dozen at any one time. Loading the file and tockenising is done I want to be able to reference back from a click on the displayed text to the underlying item with all the big gubananas in.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
|
|
|
|
|
BTW: Don't send me a badger - we have hedgepigs!
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
How about a used lepracan?
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
|
|
|
|
|
Is that a diseased Irish Fairy?
(A Leprous Leprechaun)
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
[teenager attributes=[hunch up] [hood on]]
Wot eva! u nt me dad, u cnt tll me wot 2 do! giv o...
[/teenager]
Jeez, that was awful, like have spots all over again.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
|
|
|
|
|
For that kind of functionality, as it is line-oriented, I'd go for a ListBox, not a TextBox/RichTextBox.
Fancy styling/coloring/... requires a UserDrawn mode; no biggy.
You could, not saying you should, load everything in the ListBox, and decide which of all those items are actually visible. No data movement at all!
The one thing you have to add yourself is the RTF output, since now RTF is not used for visualization; you can implement a Key event handler that acts on CTRL/C or CTRL/S (or whatever) and saves the selected items in the appropriate format. The drawback here is you would be emitting RTF code that you haven't looked at yet. You may consider adding a preview in an actual RTB.
PS: Make sure the leprous clown brings a pot of gold with him.
|
|
|
|
|
list box et al won't be any good as the messages are multi line.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
|
|
|
|
|
a listbox holds items, not necessarily strings; listbox items can take whatever height you want (constant or variable), and can look however you like. So that is not an issue. The main characteristic is: all items are arranged vertically, and there is no speed penalty as the content grows.
|
|
|
|
|
The problem with listbox is that you can only select an item, I'm trying to find out the item the selction is in.
I will be playing with some rtf stuff over the weekend, to see what happens. I are sad, I have downloaded the frakin rtf specification.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
|
|
|
|
|
I have played around quite a bit with RTF. It is a huge spec; and Word, as usual, is abusing it all the way. Stay away from Word if you can!
WordPad however is pretty decent, and it can display (and to some extent let you modify) things you can't create with WordPad, e.g. tables.
FWIW: to concatenate two RTF documents, put one in an RTB, then paste the second one into it, then save.
PS: don't consider an RTB for 10MB+ documents, it sucks big time.
|
|
|
|
|
Luc Pattyn wrote: don't consider an RTB for 10MB+ documents, it sucks big time.
I know
The final content being displayed is rarely going to be >1m, but the source files are occassionally pretty big.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
|
|
|
|
|
I've never used an RTB but can't you insert your item identifier tokens into the text, detect the position of the user click/selection and just work back through the text to find the token
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
I have to develop a cross platform C# GUI application,
I had read many form regarding to cross platform
application development I found Code Block for C++.I need
similar for C#.I need to develop Good GUI application.
Please help me choose Good IDE.
Regards,
Pavan,,
Freelancer( Independent Programmer ).
modified on Friday, July 2, 2010 11:31 AM
|
|
|
|
|
You will probably need to learn about Mono[^].
It's time for a new signature.
|
|
|
|
|
|
Hi
I have a chart control and have my y axis format like this:
Chart1.ChartAreas(0).AxisY.LabelStyle.Format == "C"
Which will show me (£ 100,£200 etc..).
I have set the .Series("Revenue").IsValueShownAsLabel = True
when i See the graph the numbers is formated for the the £ sign.
However the point values for the y axis has not been formated with £ sign.
How can i add a £ sign to each numbers of the Y values.?
Please advice.
|
|
|
|
|
Hi
I've got a desktop application that uses a WebBrowser control to let users access their Gmail accounts. I have multiple users though, and every time a users logs out of the desktop application, and a new user logs in, the WebBrowser goes to the previous users email account. How can I reset the the WebBrowser completely so that it navigates to the Gmail homepage? I tried clearing the cookies as well as the temporary internet files folder (I tried this programmatically in code as well as using the Windows way), but still no luck. It still navigates to the previous users email account. What is strange though is that when I close down the desktop application completely and run it again, the WebBrowser navigates to the Gmail homepage.
Any ideas?
|
|
|
|
|
after the user finished, set the instance of the web browser to null then call the garbage collector System.GC.Collect();
|
|
|
|
|
Thanks for the quick reply.
Okay so now when the next user tries to access his/her email, I call the following again:
this.browserGmail = new System.Windows.Forms.WebBrowser();
this.browserGmail.Location = new System.Drawing.Point(5, 53);
this.browserGmail.MinimumSize = new System.Drawing.Size(20, 20);
this.browserGmail.Name = "browserGmail";
this.browserGmail.Size = new System.Drawing.Size(914, 616);
this.browserGmail.TabIndex = 4;
browserGmail.Navigate("mail.google.com/mail");
This seems to work, but the browser doesn't get directed to any page, it just shows me a white screen?
So I tried:
browserGmail.CreateControl();
browserGmail.Update();
Still no luck
|
|
|
|
|
I did a research, i read the description of all the properties and methods in the WebBrowser class, and i didn't find a thing , i only thing that i manage to get is the credentials of users are saved on the disk not in the memory, and each application has its own place to save them with encryption, who manage this thing and how :S i don't know, sorry.
|
|
|
|
|