 |
|
|
 |
|
|
 |
|
 |
I have changed the code to display column headers. However this only works well if you set it so that the first row displays the header. Achieving a fixed header that does not disappear when you scroll is my objective.
The main issue is knowing which item is at the top of the list at any given instant of time. (So that you can double the row height and draw the header over the top.) I have not found a way of achievng this yet.
The other approach would be to get each column to display its header with the items underneith, there seems to be no property available for this
Any ideas would be appreciated.
Ewan
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
hello, I have 2 values in combobox. example: myDataRow[dc.ColumnName] = "Row: " + index + " Column: " + iCol;
How I get only the value of the second column in the row ? for example I want to receve only the value of " Column: " + iCol
thanks
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi, My form is set to RTL and when I select the item from dropdown it is displayed correctly in the combobox. How can I setup so the items displayed in the dropdown will be also RTL? Thank you!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
You are wanting it to display right to left correct? Try playing with the e.Graphics.DrawString line (line 245 in the verion of the code I have)in OnDrawItem(). The DrawString function has options for right to left string drawing.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi, First of all thank you very much for your reply, but I am still having some troubles. I have found this overload for the function DrawString. DrawString(drawString, drawFont, drawBrush, drawRect, drawFormat);
I have declared the following variable with those properties:
StringFormat drawFormat = new StringFormat(); drawFormat.Alignment = StringAlignment.Center; drawFormat.FormatFlags = StringFormatFlags.DirectionRightToLeft;
But I am still getting the same result. ( Left to Right ) 
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Sorry, I'm not much help with getting RTL working. Try this: drawFormat.Alignment = StringAlignment.Right; You may also have to use one of the DrawString overloads that has a rectangle as a parameter so it knows where to draw at.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I have found this a useful control, for a similar application where I am porting over MS Access forms.
I have a problem though, where one of my tables isn't sorted correctly in the underlying DataTable.
Using the SortBy method on your control displays the data correctly, however when retrieving the selected item, it gets the index from the original table index rather than the sorted value!
eg if I select the 5th item in the ColumnComboBox (sorted), it gets the 5th row from the DataTable.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Death to Access! What property or function are you using to get the selected item? Internally this control sorts using a DataView. So if you were to just use the SelectedIndex against your DataTable after the sorting changed, there is a good chance it would be wrong. If I understand your problem correctly you may want to try using the Items property which return the internal DataView and using the SelectedIndex against that. Here is some abbreviated code... ColumnComboBox ccb = new ColumnComboBox; //set the Data //set some view columns ccb.SortBy("blah" "DESC"); //select something
//Try this to get the correct DataRow DataRow dr = ccb.Items[SelectedIndex].Row;
If that isn't it show me what you are doing and I'll make another stab at it.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
This method of access fixes my problem.
The way I was retrieving the record was by:
string s = ccb["ColName"].ToString();
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Also, see the question below about not being able to use the SelectedItem or the SelectedValue properties.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
i write DataSet ds=Query ("Select * FROM JobCode "); comboJobCode.Data =ds.Tables [0]; comboJobCode.ViewColumn = 1; //Set a few columns to not be shown comboJobCode.Columns[0].Display = true; comboJobCode.Columns[5].Display = false; comboJobCode.SelectedValue =7;// doesnt work
Regards, Salah Hussein
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
 |
Sorry I didn't see this until today. Hotmail has been throwing away CodeProject stuff and I missed your message. The ComboBox doesn't allow you to override the SelectedValue or SelectedItem property which is the cause of the problem. If you have to be able to use one of these try making versions of the needed properties with the "new" designation.
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
 |
Nice combo, only two questions:
I have noticed that when the combo drops when autocompleting the mouse pointer dissapears, any idea on how to solve this?
The second, it would be possible highlighting the autoselected item in the list? I have searched the web and I can't find the way to highlight programmatically an item of a combobox.
Thanks.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I'm not quite sure what to do with the mouse pointer dissappearing. I have noticed it before though in this control and other windows controls. As for highlighting the selected item adjust the code in OnDrawItem() so it draws the selected item you want. It might be worth mentioning that the ComboBox in .net 2.0 does some auto completion and if you are going to be doing the drawing yourself it might be worth using the new ComboBox.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
This problem can be resolved by changing timing in which the function is called from OnTextChanged to OnKeyDown event.
Thanks,
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi there.
This control is just what i am looking for. But i can't test it, because i can find it in my toolbox. (using vs2005).
I have added the project to my solution and adden the project as a referance.
In my toolbox i can se the "MultiColumnComboSuggestionBox", but no controls in the group.
Any ideas on how i can get this thing to work ?
Thanks.
Lars E.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Sorry my reply is so slow. I didn't check my email until last night. I'm not much of an expert in getting things to show up in the toolbox. Sometimes it is there other times it isn't. When it isn't I just pull a normal ComboBox from the toolbox and then change it in the .cs code to a ColumnComboBox. This will require you to change a few lines but nothing major. Hope that helps.
-Justin
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Justin,
I am having the same problem where the control doesn't show in the toolbox for the form where I want to use it. When I included your project into my solution your form is included and properly shows the control. I know I must be missing something but I'm new to C# and this is the 1st time I've even included a second project in a solution. I would really appreciate any help you could provide.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
If after setting SelectedIndex it doesn't update the text try calling UpdateIndex(). You can also call SetToIndexOf(string) though just setting the text should work fine. I should also mention that this class doesn't work too well when the DropDownStyle is set to anything other than DropDown. This may be the cause of your problem. -JTG
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
 |
Updating the index where needed is a good idea. I'll have to add that. As far as the columns lining up, They do always line up for me but of course this means little when they aren't lining up the way you want them to. Are you by chance changing any of the Font properties of the control after it has calculated all the column widths? Also adding a StringFormat parameter to the call to Graphics.DrawString() in OnDrawItem() may help you get things lined up how you want. At one point I did have it drawing the column headings. The result was rather poor since when the control was scrolled rapidly the headings scrolled also and would jump around alot until the scrolling stopped. You could possibly get around this problem by getting the handle to the drop down window and intercepting the WM_PAINT message (and perhaps a few others)so you have more control over it. It didn't seem worth the effort but I'm sure it is doable. Maybe just invalidating the whole drop down window whenever the user scrolls. Good luck to you. If I get some time I'll experiment further. -JTG
|
| Sign In·View Thread·PermaLink | 4.00/5 (3 votes) |
|
|
|
 |