|
I've tried so hard for a whole day that I still cannot get through this tough problem, somebody please, help me!
I've got the code for Multi Column Combo in DataGridView to solve the problem of displaying multiple data, but I got stuck in displaying some values. Everything goes just fine, but when I tried to display values with the key value diplicated, it doesn't work. For example, I intended to display two rows "bmx2100 |23455 |34" and "bmx2100 |11111 |100", they have the same attribute "bmx2100", but the primary key "23455" and "11111" are different. That was what suppose to be, but now, the program displayed "bmx2100 |23455 |34" twice, and during DEBUG, I print out all the temporary variables and I found that they are all correct! So, what would be the problem!?
This is the Multi Column Combo Cell : http://www.codeproject.com/useritems/Multi_Column_Combo_Cell.asp
And this is the code snippet I modified:
protected override void OnDrawItem(System.Windows.Forms.DrawItemEventArgs e)<br />
{<br />
Rectangle rec = new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);<br />
DataGridViewMultiColumnComboColumn column = ownerCell.OwningColumn as DataGridViewMultiColumnComboColumn;<br />
DataTable valuesTbl = column.valuesTbl;<br />
string joinByField = column.joinFieldName;<br />
SolidBrush NormalText = new SolidBrush(System.Drawing.SystemColors.ControlText);<br />
object currentItem = Items[e.Index];<br />
string currentText = GetItemText(currentItem);<br />
<br />
if (e.Index > -1)<br />
{<br />
SolidBrush normalBack = new SolidBrush(Color.White);
e.Graphics.FillRectangle(normalBack, rec);<br />
if (DroppedDown && !(Margin.Top == rec.Top))<br />
{<br />
int currentOffset = rec.Left;<br />
<br />
DataRow[] itemRows = valuesTbl.Select("[" + joinByField + "]='" + currentText + "'");<br />
<br />
SolidBrush HightlightedBack = new SolidBrush(System.Drawing.SystemColors.Highlight);<br />
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)<br />
{<br />
e.Graphics.FillRectangle(HightlightedBack, rec);<br />
}<br />
StreamWriter sw = new StreamWriter(File.OpenWrite("record"));<br />
foreach (DataRow currentRow in itemRows)<br />
{<br />
bool addBorder = false;<br />
<br />
foreach (object dataRowItem in currentRow.ItemArray)<br />
{<br />
string value = dataRowItem.ToString();
<br />
<br />
<br />
#region DrawLine<br />
if (addBorder)<br />
{<br />
SolidBrush gridBrush = new SolidBrush(Color.Gray);
long linesNum = lineWidth;<br />
while (linesNum > 0)<br />
{<br />
linesNum--;<br />
Point first = new Point(rec.Left + currentOffset, rec.Top);<br />
Point last = new Point(rec.Left + currentOffset, rec.Bottom);<br />
e.Graphics.DrawLine(new Pen(gridBrush), first, last);<br />
currentOffset++;<br />
}<br />
}<br />
else<br />
addBorder = true;<br />
#endregion<br />
<br />
SizeF extent = e.Graphics.MeasureString(value, e.Font);<br />
Rectangle textRec = new Rectangle(currentOffset, rec.Y, (int)extent.Width + 20, rec.Height);<br />
<br />
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)<br />
{<br />
SolidBrush HightlightedText = new SolidBrush(System.Drawing.SystemColors.HighlightText);<br />
e.Graphics.FillRectangle(HightlightedBack, currentOffset, rec.Y, fixedAlignColumnSize, extent.Height);<br />
e.Graphics.DrawString(value, e.Font, HightlightedText, textRec); sw.Write(value + "|");<br />
}<br />
else<br />
{<br />
e.Graphics.FillRectangle(normalBack, currentOffset, rec.Y, fixedAlignColumnSize, extent.Height);<br />
e.Graphics.DrawString(value, e.Font, NormalText, textRec); sw.Write(value + "|");<br />
}<br />
currentOffset += fixedAlignColumnSize;<br />
}<br />
sw.WriteLine();<br />
}<br />
sw.Close();<br />
}<br />
else<br />
e.Graphics.DrawString(currentText, e.Font, NormalText, rec);<br />
}<br />
}<br />
<br />
}
|
|
|
|
|
I know I've already posted this on your other post, but I'm putting it here as well so you (hopefully) won't get a lot of extra responses.
You should go to the actual article (http://www.codeproject.com/useritems/Multi_Column_Combo_Cell.asp[^] and post this question in the article's discussion board. It looks similar to these forums, but is specific to each article. You can find it at the bottom of each article (not all of them have questions yet, so it may be empty) just under the voting area and the advertisement.
|
|
|
|
|
I find the new message button in the article for a long time beforehand, but I cannot find it. Luckily, I find it just now, so I post my thread there. I'm sorry and thank you for your advice!;)
|
|
|
|
|
No need to apologize. I'm glad you were able to find the right place to post your question. Hopefuly, you will get a response from the author. If not, post the question again in one of the programming forums (probably the C# forum would be the best) but make sure to say in the new message that you asked the author and never received a response. (You should also wait at least a few days to give the author time to research and respond.)
|
|
|
|
|
This my first time visiting this forum, I think that the author may not check his articles. But I guess my experience doesn't work here. If so, I'm glad that I have found such a wonderful place to communicate with talented programmers!;)
|
|
|
|
|
Sometimes you will find an author that doesn't respond to questions about his/her articles. As I mentioned, if it does happen, just repost your question to the programming forums (making sure to mention that you've already tried to ask the author but received no response) and I'm sure someone will try to help you.
This site is a great place to find a lot of talent, but since it is an online community that is (mostly) self moderated you do sometimes get some not-so-talented people and people with bad attitudes. That's just part of being a part of a large online community, you have to take the good with the bad. That being said, you tend to learn who is worth listening to and who isn't fairly quickly and can get a lot of good information, both from the articles and from the forums.
Good luck in your project and enjoy using the site.
|
|
|
|
|
It's my pleasure to meet you and I found your advice is worth listening. I'll remember what you told me and thank you again.
You're such a nice online community member
|
|
|
|
|
quakertistar wrote: You're such a nice online community member
He is isn't he?
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete O`Hanlon wrote: quakertistar wrote:
You're such a nice online community member
He is isn't he?
Thanks!
|
|
|
|
|
quakertistar wrote: It's my pleasure to meet you and I found your advice is worth listening. I'll remember what you told me and thank you again.
You're such a nice online community member
My pleasure as well...and thanks!
|
|
|
|
|
Good answer - well worth the 5 I've just voted it.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
|
I have to develop a on-line workshop tool related to simulation games.
The system has to integrate different tools such as chat, voip to be used by the initiator and a presentation tool.
Now here is the problem!
Which is the best way to develop a system where the initiator can show a live presentation (usually done in powerpoint) to the participant?
What I mean is that the initiator should control on-line the presentation (next or previous slide) while talking and the participant should see the presentation live.
I know that there is sharepoint, but the cost for the server side is expensive.
I was wondering if there is, and which is the best solution to do it with normal windows form and and standard server.
Thanks
|
|
|
|
|
Please post this in a more appropriate forum. If you were contemplating an article on it, then this would be the right forum - but you aren't, so it isn't.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
You should be asking this in a programming forum. This particular forum is for Article Ideas.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
HI!!
I am a fresher and I am working on my final year project and I need help.I am making Content management System and currently not able to decide the design issue.
The problem is as follows:-
The "admin" will only have the rights to add projects , delete projects ,add sub projects and add category and sub category for a project .
So, how should i design the system.What someone suggested me was:- Add text boxes
1) tbone- For main project selection
2) tbtwo - For Sub prob selection
3)tbthree- For category selection .
But thsi is never a solution because the level of sub proj project and category/sub actegory can be of "nth" level so how to do dat
Plz help me out
Regards
Mrinal
|
|
|
|
|
This is a fairly common design of CMS systems. I would suggest that you start by taking a look and seeing how others have solved this problem. There are a number of open source CMS solutions that you can use to identify how this has been tackled.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
You should be asking this in a programming forum. This particular forum is for Article Ideas.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
I want to know about vurtual graphic adapter in depth in respect to vista, do any body have any link or any article about it.
thanx
prashant
|
|
|
|
|
How about here[^]?
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I like that link! Simple and to the point.
|
|
|
|
|
Thanx for such a helping reply..... but for ur information I have tried that one, I dint get any satisfactory result thats why i have posted so that if some one have any idea about article regarding this.
prashant
|
|
|
|
|
For starters, it would help if you posted the question in the right forum. This one is for people to submit article requests or ideas.
Asking in any of the forums for "general knowledge" won't usually get you very far in any case. If you have specific questions, people will try to answer; otherwise searching Google should get you general information on this topic.
|
|
|
|
|
Hi folks
I am not a very technical person.
Hope you can help me solve this problem.
I have an electronic thermometer that gives an analog output. I want to display the temperature on my computer in ANALOG form ( a circular dial type display ).
How do I do this. Do I need any special input card and software. And where can I source for this.
I am using Windows XP o/s.
Thank you so much.
John
Pluto7
|
|
|
|
|
You'd have better luck asking in one of the programming forums, not this one. This is so people can submit ideas for articles.
That being said, the most help you are probably going to get is that:
Yes, you most likely need a special input card to take the analog output from the thermometer and route it to the PC. You would then need to write an application that can interface with the driver and display the results on a user interface control. Most of the people here answer questions on a volunteer basis, so you probably won't find anyone that is going to do the work for you.
|
|
|
|